Uncommon Rares
Macro APILua Scripting

Lua API Reference

Lua decisions, actions, and deterministic stdlib.

Decisions and Actions

FunctionKindRequired capabilitiesAllowed hooksDescription
combat.attack(selector)decisionhook.onCombatActionRequested@1, hook.onEnemySpotted@1Combat Action Requested, Enemy SpottedChoose the attack combat action.
combat.useAbility(abilityKey, selector)decisionhook.onCombatActionRequested@1Combat Action RequestedChoose a ready combat ability against a target selector.
combat.drinkPotion()decisionhook.onCombatActionRequested@1, hook.onEnemySpotted@1Combat Action Requested, Enemy SpottedChoose the life consumable combat action.
combat.retreat()decisionhook.onCombatActionRequested@1Combat Action RequestedRetreat from the current battle.
combat.avoid()decisionhook.onEnemySpotted@1Enemy SpottedAvoid the spotted enemy before combat starts.
loot.openContainer(timelineEventId)actionaction.openLootContainer@1Loot Container FoundOpen the found container and return generated loot items with readable item data.
loot.keepItem(item)actionaction.keepLootItem@1Currency Drop Found, Item Drop Found, Loot Container FoundPick up the current loot item or currency drop.
loot.leaveItem(item)actionaction.leaveLootItem@1Currency Drop Found, Item Drop Found, Loot Container FoundLeave the current loot item or currency drop where it is.
loot.sellItem(item)actionaction.sellLootItem@1Item Drop Found, Loot Container FoundSell the current loot item for its deterministic vendor value.
loot.salvageItem(item)actionaction.salvageLootItem@1Item Drop FoundSalvage the current loot item into deterministic crafting materials.
loot.equipItem(item, slot)actionaction.equipLootItem@1Item Drop Found, Loot Container FoundPick up and equip the current loot item in a legal slot, or keep it if it cannot be equipped.
bank.deposit(playerItemId, destination)actionaction.bankDeposit@1Bank Node ReachedDeposit one inventory item into the current bank.
bank.depositHaul()actionaction.bankDepositHaul@1Bank Node ReachedDeposit the current backpack haul into the current bank.
continue()decisionNoneAll hooksContinue the current run.
pause()decisionNoneAll hooksPause the current run.

Stdlib

ScopeFunctionDescription
mathmath.floor(value)Round a number down to the nearest integer.
mathmath.ceil(value)Round a number up to the nearest integer.
mathmath.abs(value)Return the absolute value of a number.
mathmath.min(value, ...)Return the smallest number from the arguments.
mathmath.max(value, ...)Return the largest number from the arguments.
mathmath.sqrt(value)Return the square root of a number.
stringstring.sub(value, start, end)Return a substring using Lua's one-based indexes.
stringstring.len(value)Return the string length.
stringstring.upper(value)Return an uppercase copy of a string.
stringstring.lower(value)Return a lowercase copy of a string.
stringstring.rep(value, count)Repeat a string a fixed number of times.
tabletable.insert(table, value)Insert a value into a table array.
tabletable.remove(table, position)Remove a value from a table array.
tabletable.concat(table, separator)Concatenate string or number array values.
globalpairs(table)Iterate over table keys in deterministic insertion order.
globalipairs(table)Iterate over table array values in order.
globaltype(value)Return the Lua type name for a value.
globaltostring(value)Convert a value to a string.
globaltonumber(value)Convert a string or number to a number.
globalprint(value, ...)Write values to the macro trace.