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.