Executing bangs through Lua is often cubersome, because the concatenation operator (i.e.
..) must be used repeatedly and because quotes must be properly escaped. As a result, you often end up with ugly lines such as:
Code: Select all
SKIN:Bang("!SetVariable " .. varName .. " \"" .. varValue "\"")
SKIN:Bang('!SetOption MeterTitle' .. i .. ' LeftMouseUpAction """!Execute [\" '.. tLinks[currentItem] .. '\"]"""')
In recent Rainmeter 2.3 betas, we've introduced an alternative form of
SKIN:Bang() that greatly simplifies this. The line above can now be used rewritten as:
Code: Select all
SKIN:Bang("!SetVariable", varName, varValue)
SKIN:Bang('!SetOption', 'MeterTitle' .. i, 'LeftMouseUpAction', '[' .. tLinks[currentItem] .. ']')
In other words, instead of concatenating the bang parameters and escaping quotes, you can simply pass all parameters as actual parameters of the function. The result is much easier to both read and write.
Do note that in the "improved" !SetOption example,
!Execute has been removed as
it is now deprecated.