WoW:Creating a slash command: Difference between revisions

Added a note about setting the handler function to a method of an object
m (→‎Stategy: correct labels to match bullets.)
(Added a note about setting the handler function to a method of an object)
Line 66: Line 66:
     editBox:SetText("Blah blah blah!")
     editBox:SetText("Blah blah blah!")
  end
  end
 
* If you want to set your slash command handler function to a method of an object, you will need to encapsulate the call to it inside a dummy function.
function SomeObject:SlashHandler(message, editbox)
  -- do stuff
end
SLASH_BLAH1 = "/blah"
SlashCmdList["BLAH"] = function(message, editbox) SomeObject:SlashHandler(message, editbox) end
[[Category:AddOns]]
[[Category:AddOns]]
[[Category:HOWTOs]]
[[Category:HOWTOs]]
Anonymous user