L3DT documentation
Large 3D terrain generator



Create a variable.


Declaration Zeolite.h
Implementation Zeolite.cpp

Function prototype

ZVAR zvar_Create(long VarID);


Name Type Comment
VarID long The type ID of the variable to be created.

Return value

Null if an error occurred, and a non-nullZVAR handle otherwise.


Garbage collection

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.

To restore normal scoping rules, use the C++ wrapper classes (CzVar, CzStr, CzMap, etc.). These classes automatically delete their variable handles when going out of scope, so you don't have to.

Variable size

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.

zeolite/functions/zvar_create.txt · Last modified: 2017/08/31 06:18 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki