Returns the action (and target, if applicable) for a secure macro command. Used in the default UI to parse macro conditionals.


See also Macro functions.

Signature:

action, target = SecureCmdOptionParse("cmd")

Arguments:

  • cmd - A command to be parsed (typically the body of a macro, macrotext attribute or slash command (string)

Returns:

  • action - Argument to the base macro command (e.g. the name of a spell for /cast), or the empty string ("") if the base command takes no arguments (e.g. /stopattack); nil if the command should not be executed (string)
  • target - Unit or name to use as the target of the action (string)

Examples:

-- a complex macro command for contextually casting a healing or damage spell
local macroText = "/cast [target=mouseover,harm,nodead][harm,nodead] Mind Blast ; [target=mouseover,help,nodead,exists] [help,nodead] [target=player] Flash Heal"
SecureCmdOptionParse(macroText)
-- returns "Flash Heal", "player" if no unit is targeted or moused over
-- returns "Flash Heal", "mouseover" if a friendly unit is moused over
-- returns "Flash Heal" if a friendly unit is targeted
-- returns "Mind Blast", "mouseover" if a hostile unit is moused over
-- returns "Mind Blast" if a hostile unit is targeted