engine_getvar (char* name, long* type)
LC Returns the pointer to a lite-C struct or variable of the current script.
Can be used for real time debugging.
Parameters:
name
- name of the variable or struct
(char*, no STRING*!).
type -
either NULL,
or pointer to a long
that is set to the type
of the variable: VAR_STRUCT (0), VAR_CHAR (1), VAR_SHORT (2), VAR_FIXED (3), VAR_LONG (4), VAR_FLOAT (5), VAR_DOUBLE (7).
Structs and arrays set a type of 0. If it's a pointer, VAR_POINTER (16)
is added.
Returns:
void* pointer to the variable, or NULL when the variable doesn't
exist.
Remarks:
-
If the variable or struct is a pointer, engine_getvar returns a pointer to the pointer (see example).
-
For passing the name in a STRING*, use the _chr function.
Example:
MATERIAL** pmtl = (MATERIAL**)engine_getvar("mtl_toon",NULL);
if (pmtl) // valid pointer?
my.material = *pmtl;
See also:
engine_open, engine_getvarinfo,
engine_getscript
► latest
version online