Page 1 of 1

Getting Measure Data in a Lua script

Posted: March 16th, 2018, 4:29 am
by benjam
I'm trying my hand at Lua scripting and am having an issue getting the value from a measure into the script.

Here is what I have in my ini file:

Code: Select all

[MeasureDate]
Measure=Time
Format=%FT%TZ%z

[MeasureSun]
Measure=Script
ScriptFile=sun.lua
and my lua script:

Code: Select all

function Update()
	M = SKIN:GetMeasure('MeasureDate')
	v = M.GetStringValue()
	print("v: ", v)
end
The only thing I'm getting out in the debug output is

Code: Select all

v: nil
What am I doing wrong? I'm a complete Lua newb, but a pretty good programmer...

Re: Getting Measure Data in a Lua script

Posted: March 16th, 2018, 5:41 am
by benjam
I code so much in JavaScript that the typing fingers take over before the brain can understand.

The Lua methods are called with a colon, not a dot.

:oops: