WoW API: SecureCmdOptionParse

Revision as of 22:58, 3 May 2008 by WoWWiki>Mundocani (New page: {{wowapi}} __NOTOC__ Evaluates macro options in the string and returns the appropriate sub-string or nil <!-- List return values and arguments as well as function name, follow Blizzard u...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WoW API < SecureCmdOptionParse

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

result = SecureCmdOptionParse(cmd)


Arguments

cmd
String - the string to be parsed


Returns

result
String - the selected sub-string or nil


Example

local result = SecureCmdOptionParse("[mod:alt] Alt is down; Alt is not down")

Result

If the alt key is being held down when the above line is executed then result will be "Alt is down" otherwise it will be "Alt is not down"

Commands which don't meet any of the specified conditions will return nil. For example

local result = SecureCmdOptionParse("[nomod:alt] Alt is not down")

Will return nil if the alt key is held down while it's called and will return "Alt is not down" otherwise.

Details

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.