Home

Module var

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:

 v = var.peek( "es_misn" ) -- Get the value
 if v == nil then -- Doesn't exist, so create
    var.push( "es_misn", 1 )
 else
    var.push( "es_misn", v+1 ) -- Increment value
 end
 

Functions

peek (name) Gets the mission variable value of a certain name.
pop (name) Pops a mission variable off the stack, destroying it.
push (name, value) Creates a new mission variable.


Functions

peek (name)
Gets the mission variable value of a certain name. it is.( name )

Parameters:

  • name string Name of the mission variable to get.

Returns:

    The value of the mission variable which will depend on what type
pop (name)
Pops a mission variable off the stack, destroying it.

This does not give you any value and destroys it permanently (or until recreated). ( name )

Parameters:

  • name string Name of the mission variable to pop.
push (name, value)
Creates a new mission variable.

This will overwrite existing vars, so it's a good way to update the values of different mission variables.

nil, bool, string or number.( name, value )

Parameters:

  • name string Name to use for the new mission variable.
  • value Value of the new mission variable. Accepted types are:
generated by LDoc 1.4.3 Last updated 2020-02-20 05:27:49