Naev

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. type it is.

Parameters:

  • name string Name of the mission variable to get.

Returns:

    The value of the mission variable which will depend on what
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).

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.

Parameters:

  • name string Name to use for the new mission variable.
  • value

    Value of the new mission variable. Accepted types are:

                  nil, bool, string or number.
    
generated by LDoc 1.5.0 Last updated 2024-12-21 08:10:17