sq_setclassudsize

Squirrel 3.0

sq_setclassudsize

SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize);

Sets the user data size of a class. If a class 'user data size' is greater than 0. When an instance of the class is created additional space will is reserved at the end of the memory chunk where the instance is stored. The userpointer of the instance will also be automatically set to this memory area. This allows to minimize allocations in applications that have to carry data along with the class instance.

parameters:
HSQUIRRELVM v

the target VM

SQInteger idx

an index in the stack pointing to the class

SQInteger udsize

size in bytes reserved for user data

return:

a SQRESULT