sq_setreleasehook |
void sq_setreleasehook(
HSQUIRRELVM v, SQInteger idx, SQRELEASEHOOK hook)
;
sets the release hook of the userdata, class instance or class at position idx in the stack.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- SQInteger idx
-
an index in the stack
- SQRELEASEHOOK hook
-
a function pointer to the hook(see sample below)
- remarks:
-
the function hook is called by the VM before the userdata memory is deleted.
- eg.
-
/* tyedef SQInteger (*SQRELEASEHOOK)(SQUserPointer,SQInteger size); */ SQInteger my_release_hook(SQUserPointer p,SQInteger size) { /* do something here */ return 1; }