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
|var.peek (name)||Gets the mission variable value of a certain name.|
|var.pop (name)||Pops a mission variable off the stack, destroying it.|
|var.push (name, value)||Creates a new mission variable.|
- var.peek (name)
Gets the mission variable value of a certain name.
- name: Name of the mission variable to get.
Return value:The value of the mission variable which will depend on what type it is.
- var.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: Name of the mission variable to pop.
- var.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.
- name: Name to use for the new mission variable.
- value: Value of the new mission variable. Accepted types are: nil, bool, string or number.