It is currently September 8th, 2024, 2:13 am

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

Discuss the use of Lua in Script measures.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to escape meta characters when passing string from Lua to Rainmeter?

Post by Yincognito »

Crest wrote: May 17th, 2024, 9:32 am Appreciate the sleuthing! The observation about the escaping only being required for the string.match pattern and not also the for loop line var for string.gmatch was key. Thanks for taking the time to help, I'm sure will be useful for others as well.

Will update the topic title. I suppose given this turned out to be a Lua specific issue it'd probably be better suited in the Lua script sub-forum, if anyone feels like moving it.
You're welcome, glad it helped - might be useful for me too, in the future, if the need arise. I moved the topic accordingly, was thinking the same thing as well earlier, but I wanted to get to a resolution first and was a bit tired yesterday.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth