There are some subtle points like if you want to escape '%s' (the string specifier) %%s is enough because the first % escapes the second and thus 's' becomes the literal character, no longer part of a format specifier.
In Perl, we can use \Q and \E to "quote" a string in a pattern so that any special characters are automatically escape. Using "\Q[[test]]+\E" would be the same as "\[\[test\[\]\+". Is there something similar in Lua pattern matching?
Not in the core string library, with the minor exception of the "plain substring" flag to string.find(). That's a feature of that specific function however, not of the quoting styles.
The string lib is deliberately kept simple for space reasons (the pattern matching isn't even basic regular expressions). Anything more complicated is usually dealt with by dropping in LPEG, written by one of the Lua architects. Since WoW addons can't load third-party libs, we're out of luck there.
hooksecurefunc("ActionButton_UpdateHotkeys", function (self)
local hotkey = _G[self:GetName().."HotKey"]
hotkey:SetText(hotkey:GetText():gsub("MAJ", "m"))
end)
You forgot the " " around the function name again probably.
% escapes individual magic characters.
There are some subtle points like if you want to escape '%s' (the string specifier) %%s is enough because the first % escapes the second and thus 's' becomes the literal character, no longer part of a format specifier.
Not in the core string library, with the minor exception of the "plain substring" flag to string.find(). That's a feature of that specific function however, not of the quoting styles.
The string lib is deliberately kept simple for space reasons (the pattern matching isn't even basic regular expressions). Anything more complicated is usually dealt with by dropping in LPEG, written by one of the Lua architects. Since WoW addons can't load third-party libs, we're out of luck there.
I want to know if it is possible to replace the name of the shortcut:
SHIFT > S
CTRL > C
MOUSE5 > M5 (example)
thank you
What shortcut? Where?
http://i.imgur.com/SC9aI.jpg
Example : Rush Adrenalin
MA... (maj = shift in english)
so, i would to :
MA... to : M-E (Maj + E / Shift + E)
Do you understand ?
http://forums.wowace.com/showthread.php?t=15937&page=2
Use :gsub instead.
http://www.wowwiki.com/API_gsub
Also, stop posting multiple threads about the same thing. I've merged all three of your threads about this problem into one thread.
I have this error :
Date: 2012-03-23 13:18:54
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\FixMaj\Fix.lua line 1:
Usage: hooksecurefunc([table,] "function", hookfunc)
Debug:
[C]: ?
[C]: hooksecurefunc()
FixMaj\Fix.lua:1: in main chunk
You forgot the " " around the function name again probably.