WoW API: SecureCmdOptionParse

From AddOn Studio
Revision as of 04:47, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API SecureCmdOptionParse to API SecureCmdOptionParse without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW API < SecureCmdOptionParse

Evaluates macro options in the string and returns the appropriate sub-string or nil

result, target = SecureCmdOptionParse("macroText")

Arguments[edit]

macroText
a string containing the macro conditions to be parsed.

Returns[edit]

result
The chosen clause text, or no return (nil) if none of the clauses apply.
target
The [target=(unit)] argument of the chosen clause, if such an argument exist.

Example[edit]

print(SecureCmdOptionParse("[mod:alt] Alt is down; Alt is not down")); -- Prints appropriate text
print(SecureCmdOptionParse("[target=pet] Cast at Pet")); -- Prints 'Cast at Pet', 'pet'
print(SecureCmdOptionParse("[nomod,mod] Alt is not down")); -- Prints nothing (nomod and mod cannot both be true)

Details[edit]

This command can be used to implement the same conditional processing that Blizzard's macro system uses. It is the same API they use and so supports all the same conditionals.

Note that item links can not be part of the commands because they contain square brackets [], which get interpreted by the parser as modifiers.