You can put a "/run" command in a macro. "/run" is just a slash command that executes whatever comes after it as raw Lua code, whereas "/cast" is a slash command that takes what comes after it and passes it to a pre-defined block of Lua code that casts the named spell, etc.
However, if there is something you cannot do in a "macro" (eg. "cast Spell A if it's off cooldown, otherwise Spell B" or "if the unit's health is below 20% cast X, otherwise cast Y") then you cannot do that from a "Lua script" either. Most "macro commands" -- like /cast and /use -- exist because Blizzard does not want your macro or addon making decisions about which spells to cast. They want you, the player, to have to pay attention and use a little brain power to go "oh, this unit's health is below 20%, I should use my execute ability" -- not be able to mash a single button and have some lines of code look at all the conditions and make the decision for you.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
|