Show Changes Show Changes
Edit Edit
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

11/21/2016 1:34:56 PM
-207.244.89.107
10/29/2012 12:02:27 PM
-113.22.24.174
5/14/2012 4:15:11 AM
-113.160.82.178
5/14/2012 4:14:35 AM
-113.160.82.178
5/6/2012 4:02:53 PM
-62.92.154.35
List all versions List all versions

RSS feed for the SquirrelWiki namespace

Multi V Ms
.

Back to SqPlus

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.

agen sbobet terpercaya | agen judi online

Not logged in. Log in

squirrel's community wiki

This is FlexWiki, an open source wiki engine.

Change Style

Recent Topics