Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1056

Bugs & Feature Suggestions • Re: Retrieving table elements using inline Lua

$
0
0
This is probably not a bug, maybe an omission or a mismatch between what the manual says and what's available in practice...

The manual:

In practice:

Code:

function Initialize()  t, v = {7}, 5end

Code:

[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=47,47,47,255---Measures---[Script]Measure=ScriptScriptFile=#@#Script.luaUpdateDivider=-1DynamicVariables=1---Meters---[Result]Meter=StringFontColor=255,255,255,255FontFace=ConsolasFontSize=16Padding=5,5,5,5AntiAlias=1Text=Result = [&Script:t[1]]UpdateDivider=-1DynamicVariables=1
So, it looks like one cannot get table elements with inline Lua. I can see a potential reason for that behavior as it could maybe cause some confusion in using the square brackets inside a square bracket enclosed inline Lua, but then Rainmeter parses nested variables just fine in similar cases. To check if the brackets were the issue, I also tried the dot referencing of a table element, aka [&Script:t.1], and it didn't work either.

So, should / will this be possible or not, and if not, should the manual be adjusted to mention this particularity of the inline Lua, or should we always go with the somewhat redundant workaround of using a function to retrieve a table element's value? :???:

I think this might be alluded to here:

https://docs.rainmeter.net/manual/lua-scripting/inline-lua/#Notes
Lua tables, myTable[index], may not be directly used in a parameter to the Lua function, you will need to pass the table name and the index number or string as separate parameters and use them to access the table in Lua. However, the Lua may return a single value from a table with return myTable[index]. The TranslateDay example below demonstrates this.

Statistics: Posted by jsmorley — 44 minutes ago



Viewing all articles
Browse latest Browse all 1056

Trending Articles