====== zvar_CreateShared ====== ===== Description ===== Create a named variable that may be accessed by other plugins, scripts, etc. ===== Files ===== ^ Declaration | ''Zeolite.h'' | ^ Implementation | ''Zeolite.cpp'' | ===== Function prototype ===== ZVAR zvar_CreateShared(long VarID, const char* lpVarName); ===== Arguments ===== ^ Name ^ Type ^ Comment ^ | VarID | long | The [[zeolite:VarID|type ID]] of the variable to be created. | | lpVarName | const char* | A pointer to a C-style string containing the name of the variable to be created (null if to be unnamed). | ===== Return value ===== Null if an error occurred, and a non-null ZVAR handle otherwise. ===== Comments ===== Please refer to the comments for [[zeolite:functions:zvar_Create#Comments|zvar_Create]], which are relevant to this function also. ==== Nested lists ==== If the given //lpVarName// contains the '.' (dot) character, the variable will be created in a nested list. For instance, and //lpVarName// of "list1.list2.varname" will create the variable //varname// in a list called //list2//, which itself is contained in //list1//. In this example, //list1// and //list2// will be automatically created if they do not already exist. If //list1// or //list2// do exist but are not initialised as something other than VarID_varlist, ''var_CreateShared'' will return false and error will be thrown. ==== Shared/private access ==== Variables created by ''zvar_CreateShared'' are placed into a shared memory space that can be accessed by L3DT or other plugins using [[zeolite:functions:zvar_GetSharedVar]]. If you want to create a private variable accessible only to your plugin, use [[zeolite:functions:zvar_Create]], and store the ZVAR in your plugin for later use (note [[zeolite:functions:zvar_GetSharedVar]] cannot retrieve a variable created with [[zeolite:functions:zvar_Create]].)