Create a variable.
Declaration | Zeolite.h |
---|---|
Implementation | Zeolite.cpp |
ZVAR zvar_Create(long VarID);
Name | Type | Comment |
---|---|---|
VarID | long | The type ID of the variable to be created. |
Null if an error occurred, and a non-nullZVAR handle otherwise.
ZVARs never go 'out of scope', so your plugin is responsible for deleting variables when they are no longer needed using the zvar_Delete function. If your plugin doesn't delete its variables, L3DT will do the garbage collection when it closes, and it may mock you for not cleaning up after yourself.
A variable created with zvar_Create
occupies more memory than using, say, the new operator in C++. This is because the ZVAR structure stores, in addition to the data, such things as the variable type and name string. Thus, if you wish to create a large array of variables (e.g. a million floats) you should not use zvar_Create, zvar_CreateShared or zlist_CreateItem for each item in the array, but instead use the provided buffer functions (zbuffer_xxx
), which store the data in an array without decoration.