It is currently April 20th, 2024, 7:30 am

Really? No dynamic variable to lua ?

Discuss the use of Lua in Script measures.
Afaflix
Posts: 5
Joined: May 13th, 2011, 1:20 am

Really? No dynamic variable to lua ?

Post by Afaflix »

is there any workaround so one can take a [measure], pass it on to a variable and then send that one to a lua script?

I can make it work with calls from lua ... it just feels .. inelegant.
Instead of one work progress getting called three times, I write three work-progresses which are called once.
Or .. call three near identical scripts.
User avatar
santa_ryan
Posts: 397
Joined: June 22nd, 2010, 4:11 am

Re: Really? No dynamic variable to lua ?

Post by santa_ryan »

pass the name of the measure that you want called via key/value and PROPERTIES, and then use this variable to drive another variable in the lua script for grabbing that specific measure?

rainmeter .ini skin

Code: Select all

[MeasureLuaScript1]
Measure=Script
ScriptFile="#CURRENTPATH#LuaSample.lua"
TableName=Measure1Script
CalledMeasure=Measure1

[MeasureLuaScript2]
Measure=Script
ScriptFile="#CURRENTPATH#LuaSample.lua"
TableName=Measure2Script
CalledMeasure=Measure2

[MeasureLuaScript3]
Measure=Script
ScriptFile="#CURRENTPATH#LuaSample.lua"
TableName=Measure3Script
CalledMeasure=Measure3

.Lua Script

Code: Select all

PROPERTIES =
{
CalledMeasure = "";
}


function Initialize()
     CalledMeasure = SKIN:GetMeasure(""..PROPERTIES.CalledMeasure)
end
This will let you use a single instance of the script for multiple measures, without having to include all of the measures and an If, ElseIf statement.

Could this possibly work for what you want??
Last edited by santa_ryan on May 18th, 2011, 3:20 am, edited 4 times in total.
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Really? No dynamic variable to lua ?

Post by poiru »

Might want to take a look at the PROPERTIES table, which allows you to pass values defined on the script measure (e.g. MyValue=Blaa) to Lua.