sq_bindenv

Squirrel 2.2

sq_bindenv

SQRESULT sq_bindenv(HSQUIRRELVM v, SQInteger idx);

pops an object from the stack(must be a table,instance or class) clones the closure at position idx in the stack and sets the popped object as environment of the cloned closure. Then pushes the new cloned closure on top of the stack.

parameters:
HSQUIRRELVM v

the target VM

SQInteger idx

index of the target closure

return:

a SQRESULT

remarks:

the cloned closure holds the environment object as weak reference