API GetMacroInfo: Difference between revisions

From Turtle WoW Wiki
>Basedturtle
Created page with " Return information for a macro. Returns "name", iconTextureID, "body", local = GetMacroInfo(MacroID) == Arguments == : (MacroID) :; MacroID :: Numeric - The ID number of the action to query. == Returns == :; name, iconTextureID, body, local ; ''name'' : The name of the macro ; ''iconTextureID'' : The texture of the macro ; ''body'' : The contents of the macro ; ''local'' : unknown; apears to be the numeric value 1. == Example == local name, texture, macrobod..."
 
(No difference)

Latest revision as of 11:06, 16 October 2024

Return information for a macro.

Returns "name", iconTextureID, "body", local = GetMacroInfo(MacroID)

Arguments

(MacroID)
MacroID
Numeric - The ID number of the action to query.

Returns

name, iconTextureID, body, local
name
The name of the macro
iconTextureID
The texture of the macro
body
The contents of the macro
local
unknown; apears to be the numeric value 1.

Example

local name, texture, macrobody, localVar = GetMacroInfo(1)


Call a macro or use chat commands in Lua.

local function ExecuteMacro(macro)
   local _, _, body = GetMacroInfo(macro)
   local commands = strsplit(body, '\n')
   for i = 1, sizeof(commands) do
      ChatFrameEditBox:SetText(commands[i])
      ChatEdit_SendText(ChatFrameEditBox)
   end
end