Multi V Ms
Last changed: -207.244.89.107

.

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.

http://www.laocaitravel.com

http://wikidulich.org

http://wikidulich.org/wiki/dulichsapa

http://v3vn.com/tag/game-java

http://v3vn.com/wap-app-game/tai-phan-mem-doc-truyen-wattpad-online-tieng-viet.html