![]() |
naev 0.12.5
|
Lua Variable module. More...

Go to the source code of this file.
Functions | |
| static int | varL_peek (lua_State *L) |
| Gets the mission variable value of a certain name. | |
| static int | varL_pop (lua_State *L) |
| Pops a mission variable off the stack, destroying it. | |
| static int | varL_push (lua_State *L) |
| Creates a new mission variable. | |
| int | nlua_loadVar (nlua_env env) |
| Loads the mission variable Lua library. | |
| static lvar * | var_get (const char *str) |
| Gets a mission var by name. | |
| int | var_save (xmlTextWriterPtr writer) |
| Saves the mission variables. | |
| int | var_load (xmlNodePtr parent) |
| Loads the vars from XML file. | |
| static int | var_add (lvar *new_var, int sort) |
| Adds a var to the stack, strings will be SHARED, don't free. | |
| int | var_checkflag (const char *str) |
| Mission variable Lua bindings. | |
| void | var_cleanup (void) |
| Cleans up all the mission variables. | |
Variables | |
| static lvar * | var_stack = NULL |
| static const luaL_Reg | var_methods [] |
Lua Variable module.
Definition in file nlua_var.c.
| int nlua_loadVar | ( | nlua_env | env | ) |
Loads the mission variable Lua library.
| env | Lua environment. |
Definition at line 45 of file nlua_var.c.
|
static |
Adds a var to the stack, strings will be SHARED, don't free.
| new_var | Variable to add. |
| sort | Whether or not to sort. |
Definition at line 99 of file nlua_var.c.
| int var_checkflag | ( | const char * | str | ) |
Mission variable Lua bindings.
Mission variables are similar to Lua variables, but are conserved for each player across all the missions. They are good for storing campaign or other global values.
Typical usage would be:
Lua module: var
Checks to see if a mission var exists.
| str | Name of the mission var. |
Definition at line 131 of file nlua_var.c.
| void var_cleanup | ( | void | ) |
Cleans up all the mission variables.
Definition at line 194 of file nlua_var.c.
|
static |
Gets a mission var by name.
Definition at line 54 of file nlua_var.c.
| int var_load | ( | xmlNodePtr | parent | ) |
Loads the vars from XML file.
| parent | Parent node containing the variables. |
Definition at line 79 of file nlua_var.c.
| int var_save | ( | xmlTextWriterPtr | writer | ) |
Saves the mission variables.
| writer | XML Writer to use. |
Definition at line 65 of file nlua_var.c.
|
static |
Gets the mission variable value of a certain name.
Lua function parameter: string name Name of the mission variable to get. Lua return parameter: The value of the mission variable which will depend on what type it is.
| L | Lua State |
Lua function: peek
Definition at line 144 of file nlua_var.c.
|
static |
Pops a mission variable off the stack, destroying it.
This does not give you any value and destroys it permanently (or until recreated).
Lua function parameter: string name Name of the mission variable to pop.
| L | Lua State |
Lua function: pop
Definition at line 162 of file nlua_var.c.
|
static |
Creates a new mission variable.
This will overwrite existing vars, so it's a good way to update the values of different mission variables.
Lua function parameter: string name Name to use for the new mission variable. Lua function parameter: value Value of the new mission variable. Accepted types are: nil, bool, string or number.
| L | Lua State |
Lua function: push
Definition at line 183 of file nlua_var.c.
|
static |
Mission variable Lua methods.
Definition at line 34 of file nlua_var.c.
|
static |
Stack of mission variables.
Definition at line 26 of file nlua_var.c.