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

Lua Scripting • How to properly escape strings containing magic/meta characters when using string.match/gmatch in for loops in Lua?

$
0
0
So I have a script that defines a string like:

Code:

myTable = {    myString = "Here is (something)"}
This string gets used later in the script via a bang to change a meter's text.

The issue is that various meta characters like parentheses, square brackets and asterisks cause the entire string to not get parsed on the INI side. So in the current version of the script I've simply removed them from the string.

I've looked through the site but couldn't find how to escape the characters in this scenario. I've tried `\`, raw unicode character reference, wrapping with asterisks, different quoting types but still fails to parse with them present.

Is there a way?



Edit: title renamed from: How to escape meta characters when passing string from Lua to Rainmeter?

Statistics: Posted by Crest — May 15th, 2024, 3:06 pm — Replies 10 — Views 271



Viewing all articles
Browse latest Browse all 473

Trending Articles