comparison OOCDo.lua @ 7:e41de98f6b33

.MacroText: explicitly set button type, as newer commands could change it to something else; luadoc.
author rowaasr13
date Tue, 10 Jan 2017 19:39:55 +0300
parents 0a7fd4d73d30
children 3b9bc71a1dd6
comparison
equal deleted inserted replaced
6:0a7fd4d73d30 7:e41de98f6b33
16 button, -- header 16 button, -- header
17 'return nil, "reset"', -- pre 17 'return nil, "reset"', -- pre
18 'self:SetAttribute("type", "macro") self:SetAttribute("macrotext", "")' -- post 18 'self:SetAttribute("type", "macro") self:SetAttribute("macrotext", "")' -- post
19 ) 19 )
20 20
21 --- Sets button to perform given macro text as-is.
22 -- Sets button's .type to "macro" and .macrotext to given string verbatim
23 -- @param command macro text to perform
24 -- @param command2 same as command, if first argument is "taken" because of : call.
21 function button.MacroText(command, command2) 25 function button.MacroText(command, command2)
22 if command == button then command = command2 end 26 if command == button then command = command2 end
23 if InCombatLockdown() then return end 27 if InCombatLockdown() then return end
28 button:SetAttribute("type", "macro")
24 button:SetAttribute("macrotext", command) 29 button:SetAttribute("macrotext", command)
25 end 30 end
26 31
27 button.Macro = button.MacroText 32 button.Macro = button.MacroText
28 button.T = button.MacroText 33 button.T = button.MacroText