sq_getfreevariable

Squirrel 3.0

sq_getfreevariable

const SQChar * sq_getfreevariable(HSQUIRRELVM v, SQInteger idx, SQInteger nval);

gets the value of the free variable of the closure at the position idx in the stack.

parameters:
HSQUIRRELVM v

the target VM

SQInteger idx

index of the target object in the stack(closure)

SQInteger nval

0 based index of the free variable(relative to the closure).

return:

the name of the free variable for pure squirrel closures. NULL in case of error or if the index of the variable is out of range. In case the target closure is a native closure, the return name is always "@NATIVE".

remarks:

The function works for both squirrel closure and native closure.