Show Changes Show Changes
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Topic Locks Topic Locks

Search

History

6/7/2007 1:17:30 PM
-84.49.122.175
5/30/2007 12:28:16 PM
-125.72.28.38
5/28/2007 6:20:25 AM
-69.136.148.27
10/14/2005 7:10:05 PM
info@brightland.com-66.27.77.187
10/14/2005 7:09:31 PM
info@brightland.com-66.27.77.187
List all versions List all versions

RSS feed for the SquirrelWiki namespace

Multi V Ms
.

Check out the formatting tips on the right for help formatting and making links.

Use the template below:

Summary

Response to a forum question regarding isolating multiple scripts:


// If I understand your question correctly, you want to isolate registered functions for multiple scripts (for sandboxing?). If so, you could create additional VM's:

SquirrelVM::Init();
HSQUIRRELVM vm1 = SquirrelVM::GetVMPtr(); // Get original _VM from SquirrelVM::Init().
SquirrelVM::Init();
HSQUIRRELVM vm2 = SquirrelVM::GetVMPtr(); // Get new _VM.

Then before calling script functions (including binding functions for each VM):

SquirrelVM::SetVMPtr(vm1);
//... register and call scripts setup under vm1

SquirrelVM::SetVMPtr(vm2);
//... register and call scripts setup under vm2

//At shutdown:

SquirrelVM::SetVMPtr(vm2);
SquirrelVM::Shutdown();
SquirrelVM::SetVMPtr(vm1);
SquirrelVM::Shutdown();

Creating multiple root tables and switching them is another solution.

Not logged in. Log in

squirrel's community wiki

This is FlexWiki, an open source wiki engine.

Change Style

Recent Topics