It is currently April 20th, 2019, 1:20 pm

Array Variables

Report bugs with the Rainmeter application and suggest features.
LordgodEric
Posts: 4
Joined: April 21st, 2013, 1:46 pm

Array Variables

LordgodEric » February 9th, 2019, 10:47 am

Would it be possible to implement "Array" variables within Rainmeter?

Thanks for any help or suggestions.
User avatar
balala
Rainmeter Sage
Posts: 8080
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Array Variables

balala » February 9th, 2019, 12:50 pm

LordgodEric wrote:
February 9th, 2019, 10:47 am
Would it be possible to implement "Array" variables within Rainmeter?
I'd say it's not, but what are you exactly thinking about?
LordgodEric
Posts: 4
Joined: April 21st, 2013, 1:46 pm

Re: Array Variables

LordgodEric » February 15th, 2019, 11:48 am

Mainly being able to process an unknown number of the same calculations on some data sets without having to individually name each variable or measure. So I could use just one "function" measure (calculation) to perform the function. I imagine this could be done via Lua plugin, but the tutorials I have found are kind of vague as to how exactly it links into Rainmeter and how to pass data back and forth.
rxtd
Posts: 94
Joined: April 30th, 2017, 11:51 am

Re: Array Variables

rxtd » February 15th, 2019, 12:43 pm

LordgodEric wrote:
February 15th, 2019, 11:48 am
an unknown number of the same calculations on some data sets
I believe you need loops for such a thing. Rainmeter isn't built to have loops, they are quite tricky to write.
I really doubt it will be easier to use than scripts in Lua.
LordgodEric wrote:
February 15th, 2019, 11:48 am
having to individually name each variable or measure
I'm not a Rainmeter dev but I say that measures aren't ever gonna be defined as arrays.
If you only need to access them using some index then you can use nested variables. Write

Code: Select all

[variables]
qwe_1=a
qwe_2=b
x=1
And then you can use it like this: [#qwe_[#x]]. Also works with measures: [&MeasureName[#x]].
User avatar
balala
Rainmeter Sage
Posts: 8080
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Array Variables

balala » February 15th, 2019, 2:55 pm

LordgodEric wrote:
February 15th, 2019, 11:48 am
Mainly being able to process an unknown number of the same calculations on some data sets without having to individually name each variable or measure. So I could use just one "function" measure (calculation) to perform the function. I imagine this could be done via Lua plugin, but the tutorials I have found are kind of vague as to how exactly it links into Rainmeter and how to pass data back and forth.
Or, beside rxtd's reply, as you thought, a Lua script can be used (it's not a plugin though). If properly written (to use Inline Lua) it is an extremely versatile tool.
For example, in the attached skin, the value of the [MeasureCalc] measure is increased by 1 at each update of the skin. This value is get by the Double function of the lua script file and doubled by this function. The result is returned to the String meter of the skin. Obviously a such operation can be made much more easier by a simple Calc measure, the meaning of this lua script is just to demonstrate how this Inline Lua feature is working.
Also note that if inline lua is used, the [MeasureLuaScript] Script measure can be even disabled (and in this case it is), the function used through it still works.
You do not have the required permissions to view the files attached to this post.
LordgodEric
Posts: 4
Joined: April 21st, 2013, 1:46 pm

Re: Array Variables

LordgodEric » February 18th, 2019, 10:22 am

Thanks for all the info folks.
User avatar
balala
Rainmeter Sage
Posts: 8080
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Array Variables

balala » February 18th, 2019, 5:40 pm

LordgodEric wrote:
February 18th, 2019, 10:22 am
Thanks for all the info folks.
Did the Inline Lua help?