I done a simple Lua script for me and now I want to use some bangs in it. The normal bangs aren't the problem, but I have 2+... bangs that don't work and I have no idea why.
The problem is that the meters aren't in the same config like the lua script + I have a lua variable New in my bangs.
In Lua, forward slashes are an escape character. This means that if you want to use a literal forward slash in your string you need to double it. Also, you forgot some quotes. When you need to use quotes inside the string, use ' to define it.
SKIN:Bang('!SetOption Music LeftMouseUpAction """[!SetOption BgLineLightTop H (#Y_BgMusic#-1)][!SetOption BgLineDarkTop H (#Y_BgMusic#-2)][!SetVariable H_LineTop #Y_BgMusic#][!SetVariable H_LineBottom (#H_Bar#-#Y_BgMusic#-'..New..')][!HideGroup AlcTab][!Show AlcBar\Music][!HideMeterGroup Hover][!ShowMeter Music_Active][!Update]""" AlcBar\\Bar')
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
smurfier wrote:In Lua, forward slashes are an escape character. This means that if you want to use a literal forward slash in your string you need to double it. Also, you forgot some quotes. When you need to use quotes inside the string, use ' to define it.
Ahh doubled. Thanks smurfier, I will try it tomorrow and let you know if it works.
Good Night
Rainmeter - You are only limited by your imagination and creativity.
Now that I found that Lua supports dynamic variables (in contrast to RM), I need the 2 bangs at the moment not. And my other bangs work now, too. Like:
There really is no difference as far as Lua is concerned between a single and double quote. Lua, like most languages, uses both primarily to allow quoting within quoting by alternating them.
Having said that, what I find makes things the easiest to read and debug when using Lua with Rainmeter, is to always use single quotes to quote strings in Lua itself, and use double quotes when you want to send a quoted string to Rainmeter. That way it is easy to spot when you are sending quotes to Rainmeter, when it needs it, like when there is white space in a bang value, and when you are just quoting a string in Lua.