1) The PROPERTIES table used at the top of the Lua script to retrieve "settings" from the Script measure in the skin has been eliminated. The new SELF: prefix, which will allow you to access the calling script measure without needing any SKIN:GetMeasure() function allowed us to improve and add to the GetOption() / GetNumberOption() functions to remove the need for the PROPERTIES table.
So in a skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[Variables]
VarSetting=Neither
[MeasureTime]
Measure=Time
Format=%#S
[MeasureCalc]
Measure=Calc
Formula=MeasureTime
IfAboveValue=29
IfAboveAction=!Execute [!SetOption MeasureLuaScript ActionSetting 100][!SetVariable VarSetting "Above"]
IfBelowValue=30
IfBelowAction=!Execute [!SetOption MeasureLuaScript ActionSetting ""][!SetVariable VarSetting "Below"]
[MeasureLuaScript]
Measure=Script
ScriptFile=Test.lua
NumberSetting=5
StringSetting="Rainmeter"
FormulaSetting=(#SCREENAREAWIDTH# / 2)
MeasureSetting=[MeasureTime]
VarSetting=#VarSetting#
UpdateDivider=5
DynamicVariables=1
[MeterOne]
Meter=Image
SolidColor=255,255,255,255
W=20
H=20
Code: Select all
function Initialize()
sStringSetting = SELF:GetOption('StringSetting', 'N/A')
iNumberSetting = SELF:GetNumberOption('NumberSetting')
end -->Initialize
function Update()
local iFormulaSetting = SELF:GetNumberOption('FormulaSetting')
local sMeasureSetting = SELF:GetNumberOption('MeasureSetting')
local sVarSetting = SELF:GetOption('VarSetting')
local sActionSetting = SELF:GetOption('ActionSetting')
print(iNumberSetting, sStringSetting, iFormulaSetting, sMeasureSetting, sVarSetting, sActionSetting)
return "Done"
end -->Update
Code: Select all
Debug 00:33:34.469 5 Rainmeter 840 52 Above 100
As you can see, this both eliminates the need for the PROPERTIES table, and adds some new flexibility and functionality.
2) We have added a new ParseFormula() function, which will allow a Lua script to treat a string containing a formula as a formula and return the value result. This is going to be particularly useful in sending formulas and measure values in a !CommandMeasure statement to a script.
Skin:
Code: Select all
[MeterOne]
Meter=Image
SolidColor=255,255,255,255
W=20
H=20
LeftMouseUpAction=!CommandMeasure MeasureLuaScript "MyFunc('([MeasureTime] * 1.7)')"
Code: Select all
function MyFunc(Parm)
iCalculatedValue = SKIN:ParseFormula(Parm)
print('Function Value: '..iCalculatedValue)
end -->MyFunc