This isn't anything to do with lua per-se....but it is how Rainmeter is "determining" a string argument from a number (or nil/true/false).
Basically, when Rainmeter is parsing the string, it replaces [&Text] with It's, which results in:
[&Script:Result('It's',' not correct like this',2,1)]
The parser then tries to split 'It's',' not correct like this',2,1 into separate arguments. Since commas are perfectly valid when located between matching quote pairs, the results ends up a single argument.
The fix for this particular example is to use double quotes, which you attempted to do in the Substitute. That won't work though since the Substitute parser will also suffer from a mis-matched quote issue. In this case, you need to use double quotes in the commented-out Text option in your Result meter. (You may also need remove the Substitute on the measure as well.)
However, you may run into the same problem if the original string contains a double quote. "
But this works (because of matching double quotes within the string):Note: Original string has double quotes within the string, and there is an extra comma within the single quoted string. But it won't work if only 1 double quote mark is used.
-Brian
Basically, when Rainmeter is parsing the string, it replaces [&Text] with It's, which results in:
[&Script:Result('It's',' not correct like this',2,1)]
The parser then tries to split 'It's',' not correct like this',2,1 into separate arguments. Since commas are perfectly valid when located between matching quote pairs, the results ends up a single argument.
The fix for this particular example is to use double quotes, which you attempted to do in the Substitute. That won't work though since the Substitute parser will also suffer from a mis-matched quote issue. In this case, you need to use double quotes in the commented-out Text option in your Result meter. (You may also need remove the Substitute on the measure as well.)
Code:
[Text]Measure=StringString=It's---Meters---[Result]Meter=StringAntiAlias=1Text=Result = [&Script:Result("[&Text]",' not correct like this',2,1)]UpdateDivider=-1DynamicVariables=1
But this works (because of matching double quotes within the string):
Code:
[Text]Measure=StringString=It's "complicated"---Meters---[Result]Meter=StringAntiAlias=1Text=Result = [&Script:Result("[&Text]",', but correct',2,1)]UpdateDivider=-1DynamicVariables=1
-Brian
Statistics: Posted by Brian — Today, 7:09 am