I was wondering if anybody could confirm this. I was trying to use a number value returned from a Lua script into a BAR meter. To my surprise, it returns zero all the time! I tried squeezing the number through a CALC measure, but again, nada. It seems that the only values I get from the script are the ones returned from GetStringValue().
So, this works fine for STRING meters. But what about those meters that require numeric inputs, like BAR and CALC? Does anybody have any insights? Comments? Suggestions? Beer?
---
Test code:
Code: Select all
;
; GetValueTest - To test the return value from a lua script
;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
[Rainmeter]
Author=rmenezes
Update=1000
[Metadata]
Name=GetValueTest
Description=To test the return value from a lua script
;
; Styles
;
[sText]
FontFace=Arial Narrow
StringStyle=BOLD
FontColor=FFFFFFFF
FontSize=11
AntiAlias=1
[sBar]
BarColor=00FF00FF
SolidColor=FF0000FF
BarOrientation=HORIZONTAL
;
; Measures
;
[mGetValue]
Measure=Script
ScriptFile=#CURRENTPATH#GetValueTest.lua
TableName=luaTable
UpdateDivider=10
[mGetValueCalc]
Measure=Calc
Formula=mGetValue
;
; Meters
;
[GetValue]
X=0
Y=R
Meter=STRING
MeterStyle=sText
MeasureName=mGetValue
Text="GetValue: %1"
[GetValueCalc]
X=0
Y=R
Meter=STRING
MeterStyle=sText
MeasureName=mGetValueCalc
Text="GetValue (Calc): %1"
[BarValue]
X=0
Y=R
W=300
H=5
Meter=BAR
MeterStyle=sBar
MeasureName=mGetValue
[BarValueCalc]
X=0
Y=R
W=300
H=5
Meter=BAR
MeasureName=mGetValueCalc
MeterStyle=sBar
Code: Select all
--
-- GetValueTest - To test the return value from a lua script
--
-- Required but not used
PROPERTIES = { }
-- Before start
function Initialize()
-- Nothing to do
end
-- Do it
function Update()
-- Nothing to do, either
end
-- Return values
-- Uncomment/comment the function to be tested
function GetValue()
return tonumber(0.5)
end
--function GetStringValue()
-- return tostring(0.5)
--end
Rainmeter 2.0.0 rev 745(64-bit) Feb 6 2011
---
When it rains, it pours