Since the square brackets are not feasible at this moment from native Rainmeter, I thought of sharing another workaround that you can use for now in this case...
Code: Select all
function Test(p) p = p:gsub('[%s%|]*$','') print(p) print(('的笑容'):gsub('[的笑容]','#')) return true end
A bit of a hack, but anyway: you provide Rainmeter/Lua enough characters to "eat" at the end of the string parameter used in the function, by adding a -like variable to it, as long as you like or need. When in Lua, chars will be eaten from the end of the string due to the multibyte Chinese characters (which, by the way, are actually 3 bytes in length each, see the last in the function), but if your string is long enough, no chars from the main string will get lost. Then, you apply a to the result, deleting the leftovers at the end of the string - largely made of spaces and - to get the correct result: It's not as elegant or foolproof as the first workaround, but it's a possibility that allows you to use inline syntax freely, assuming you add that variable to any possible string that might have such multibyte characters.
Code: Select all
[Variables] Sec.SaveLocation=C:\Users\Super Idol的笑容\Documents\Rainmeter\Skins\ValliStart\@Resources\Vars.inc CharsToEat=| | [Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 BackgroundMode=2 SolidColor=47,47,47,255 ---Measures--- [Func] Measure=Script ScriptFile=#@#Scripts\Func.lua UpdateDivider=-1 OnUpdateAction=[&Func:Test('#Sec.SaveLocation##CharsToEat#')] DynamicVariables=1 ---Meters--- [MeterTest] Meter=String FontFace=Consolas FontColor=255,255,255,255 Padding=5,5,5,5 FontSize=16 AntiAlias=1 Text="Func = #Sec.SaveLocation#" UpdateDivider=-1 DynamicVariables=1