Code: Select all
function conditional(cond, true_str, false_str)
if cond then
return true_str
else
return false_str
end
end
So this:
Code: Select all
print(conditional(10 > 18, 'Yes', 'No'))
Here you can check that's true: https://onecompiler.com/lua/42vdzfkm4
The problem is that rainmeter will always return true (yes) no matter what.
Example skin:
#@#Script.lua
Code: Select all
function conditional(cond, true_str, false_str)
if cond then
return true_str
else
return false_str
end
end
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Script]
Measure=Script
ScriptFile=#@#Script.lua
UpdateDivider=-1
DynamicVariables=1
[Condition]
Measure=String
String=[&Script:conditional(10 > 18,'Yes','No')]
UpdateDivider=-1
DynamicVariables=1
[MeterResult]
Meter=String
FontFace=Consolas
FontColor=225,255,255,255
SolidColor=9,25,25,255
Padding=5,5,5,5
FontSize=18
AntiAlias=1
MeasureName=Condition
Text="Condition result: %1"
DynamicVariables=1
I'm guessing the problem is a syntax one, so please enlighten me with your knowledge .
I already tried '10 > 18', ''10 > 18'', "10 > 18", (10 > 18), '(10 > 18)' without luck. There's also no errors on the log.