Extension:VariablesLua

The VariablesLua extension provides support for the Variables extension in Lua modules by the Scribunto extension.


 * Bugs and Feature Requests: Issues at Github

Usage
Manual: Liquipedia Help

The extension can be loaded in Lua modules by the Scribunto extension like this:

Functions
Functions are based on the ones provided by the Variables extension, adding some more utility.

VariablesLua.vardefine
Stores the given value under the given name. If the value is, an empty string is stored.

VariablesLua.vardefineecho
Identical to VariablesLua.vardefine, but returns the value after storing it.

VariablesLua.var
Retrieve a variable stored under the given name.

VariablesLua.varexists
Checks if a variable exists. Returns a boolean value.

VariablesLua.var_final
Returns the last value stored (i.e. the last VariablesLua.vardefine or #vardefine in the code). The value can only be returned and not be used in the Lua code itself.

VariablesLua.var_table
Returns a table of all defined variables, using the variable names as table keys.

Version history

 * 1.0.0:
 * Initial release.
 * 1.1.0:
 * Fixed  on newer versions of Extension:Variables.
 * 1.2.0:
 * Added argument type checking.
 * 1.2.1:
 * Bug fixes.
 * 1.3.0:
 * Added.