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

Bugs & Feature Suggestions • [BUG] Parsing of Lua function

$
0
0
This is interesting since it became apparent to me when dealing with both Lua parsing, multiple argument functions, quotes / apostrophes, substitutes and obviously nested variables...

...\@Resources\Script.lua:

Code:

function Result(text, othertext, numberone, numbertwo)  print(text)  return textend
...\Skin.ini:

Code:

[Variables][Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=0,255,0,255---Measures---[Script]Measure=ScriptScriptFile=#@#Script.luaUpdateDivider=-1[Text]Measure=StringString=It'sRegExpSubstitute=1Substitute="^(.+)$":"[&Script:Result('[&Text]',' not correct like this',2,1)]";Substitute="^(.+)$":'[&Script:Result("[&Text]"," not correct like this",2,1)]'UpdateDivider=-1DynamicVariables=1---Meters---[Result]Meter=StringAntiAlias=1MeasureName=TextText=Result = %1;Text=Result = [&Script:Result('[&Text]',' not correct like this',2,1)]UpdateDivider=-1DynamicVariables=1
For simplicity, the script should simply return the first argument that was given to it, but it doesn't. Without the apostrophe it does. I let some alternatives in the comments, which produce either the same (wrong) result, or worse (errors). Didn't test if it also happens for "normal" (i.e. not inline) Lua. I tried to use [[ ]] literal syntax to pass the problematic argument to the Lua function, but naturally, since square brackets mean something else in Rainmeter, it didn't make any difference for the better. Escaping using \" in Lua doesn't make much sense since it's about apostrophes and they exist in the strings from my actual scenario. I guess one could just replace apostrophes with something else and avoid the whole thing or come up with other workarounds specific to the use case, but those won't fix the issue itself.

Statistics: Posted by Yincognito — Yesterday, 10:42 pm



Viewing all articles
Browse latest Browse all 1056

Trending Articles