Script measure: New SKIN:Bang() syntax
Posted: May 21st, 2012, 8:32 am
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:
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:
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.
Code: Select all
SKIN:Bang("!SetVariable " .. varName .. " \"" .. varValue "\"")
SKIN:Bang('!SetOption MeterTitle' .. i .. ' LeftMouseUpAction """!Execute [\" '.. tLinks[currentItem] .. '\"]"""')
Code: Select all
SKIN:Bang("!SetVariable", varName, varValue)
SKIN:Bang('!SetOption', 'MeterTitle' .. i, 'LeftMouseUpAction', '[' .. tLinks[currentItem] .. ']')
Do note that in the "improved" !SetOption example, !Execute has been removed as it is now deprecated.