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.

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.
 * 1.4.0:
 * Removed  due to changes in Extension:Variables.
 * 1.4.1:
 * Some minor updates, nothing security relevant but can potentially avoid weird edgecases.
 * 1.4.2:
 * Renamed some functions and classes to be in line with the MediaWiki styleguide.