It is currently March 28th, 2024, 10:54 pm

Getting Measure Data in a Lua script

Get help with creating, editing & fixing problems with skins
User avatar
benjam
Posts: 26
Joined: October 16th, 2009, 6:49 am
Location: Utah, USA

Getting Measure Data in a Lua script

Post 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...
Look at me still talking when there's Science to do.
Image
User avatar
benjam
Posts: 26
Joined: October 16th, 2009, 6:49 am
Location: Utah, USA

Re: Getting Measure Data in a Lua script

Post 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:
Look at me still talking when there's Science to do.
Image