Uncommon Rares
Macro APILua Scripting

Writing Lua Macros

How Lua macros execute inside Macro Studio hooks.

A Lua macro is one script bound to one hook. The hook supplies a read-only ctx table, and the script returns a decision or falls off the end to continue.

Globals do not survive between invocations. Documented as a guarantee so the future memory API is additive rather than a behavior change.

print(...) writes an info entry to the macro run trace.

Enemy Spotted

if ctx.combat.currentLifeRatio < 0.3 and ctx.combat.hasLifeConsumable then
  return combat.drinkPotion()
end

return combat.attack("lowestLife")