1) The manual (I included a typo, just to spice things up...):
2) What actually happens...The syntax of an inline Lua call to a function() is:
[&ScriptMeasureName:LuaFunctionName(numberParameter, 'stringParameter', ...)]
The types of parameters that can be passed to the Lua function() are:
Number Any number literal, formula or variable that resolves to a number.
String Any 'string' literal, or variable that resolves to a string, enclosed in 'single quotes'.
Boolean One of either true or false.
Code: Select all
function Result(number) return number end
So, according to the manual (or at least my understanding of it), the Result() function's argument / parameter should be (7+3) ... which is a "formula that resolves to a number", i.e. 10. Thus, Lua should receive the call to Result(10) and return 10, but it doesn't and returns 0, meaning the parsing "failed" or rather it expected a number literal or a variable only. As a side not, if I do [&MeasureScript:Result(7+3)], i.e. using only one set of round brackets, I get 7.
Code: Select all
[Variables] [Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 BackgroundMode=2 SolidColor=47,47,47,255 ---Measures--- [MeasureScript] Measure=Script ScriptFile=#@#Script.lua UpdateDivider=-1 ---Meters--- [MeterTest] Meter=String FontFace=Consolas FontColor=255,255,255,255 Padding=5,5,5,5 FontSize=16 AntiAlias=1 Text="Script = [&MeasureScript:Result((7+3))]" UpdateDivider=-1 DynamicVariables=1
I know I can call SKIN:ParseFormula() from within Lua if I pass the operation as a string and all that, but I thought the formula would be parsed by Rainmeter before sending it to Lua, similar to how Rainmeter variables are parsed before they get to Lua. Was I mistaken?
P.S. Feel free to move this thread appropriately if this is a bug.