

If the script file is changed by a !SetOption bang, the new script's Initialize function is called as well. This happens even if the script measure is disabled.
#Lua script in fastoredis skin
If the Initialize function is defined in any script, the function is called one time (without parameters) when the skin is activated or refreshed. Because single-quotes ( ') and double-quotes ( ") are both valid string containers in Lua, while only double-quotes are recognized in Rainmeter, single quotes are recommended when passing strings with !CommandMeasure. !CommandMeasure "MyScriptMeasure" "a = b print(SKIN:ParseFormula('(2+2)'))"Īll statements must be passed as a single parameter in the bang. Multiple statements may be separated by semicolons ( ). !CommandMeasure "MyScriptMeasure" "MyFunction()" The !CommandMeasure bang can be used to execute Lua code in the context of a particular script instance:
#Lua script in fastoredis update
If these functions are used in the Update function, they will return the current values at the time the function is called. This is because functions are provided to get the current values of variables, measures and options within Lua. ĭynamic variables are generally not needed with script measures. This allows the same script file to be used with different parameters depending on the context. The script can read and use its own option values using the SELF object functions. These options may have any name and value, and may be changed with !SetOption. In addition to general measure options and ScriptFile, scripts also allow user-defined options. (The order in which scripts are executed is determined by the measure order.) "Global" variables are not shared between instances. This means that a skin can have any number of scripts loaded simultaneously-even from the same script file. Much like plugin measures, each script measure creates a separate instance of its script. The script file must be a text file, and typically has the extension.

The script measure is used to load a Lua script from a file and interface with the script. The rest of this page assumes a basic knowledge of the Lua language. Programming in Lua by Roberto Ierusalimschy.More documentation for Lua itself is available at: This page details the Rainmeter-specific modifications and new functions that have been added to Rainmeter's built-in Lua environment.

These functions may be executed when the skin loads, when it updates, or on command. Rainmeter includes the Lua 5.1 standard libraries, which encompass a variety of powerful features.Ī script refers to a set of Lua functions that is associated with a script measure. Rainmeter has the ability to load and execute scripts in Lua, a functional programming language.
