Skip to content

Lua Scripting Guide

Write custom hero automation scripts using Lua. Scripts run as coroutines, with access to player data, targeting, abilities, and input.

Getting Started

  1. Place .lua files in C:/Deadlock (created automatically if it doesn't exist)
  2. Click Reload Scripts in the Hero tab or restart to load them

Quick Example

lua
name = "Example"
id = hero_id.abrams

function is_enabled()
    return config.get_bool("enabled") and input.is_key_held(VK.XBUTTON2)
end

function on_tick()
    local target = targeting.find_closest(5.0, 50.0)
    if not target then return end

    if ability.is_ready(slot.ability1) then
        press_ability(slot.ability1)
    end
end

settings = {
    { key = "enabled", type = "bool", default = false, label = "Enabled" },
}

on_tick() runs as a coroutine — it's resumed once per tick (~1ms). Call coroutine.yield() to pause until the next tick. If your script runs for more than 5 seconds without yielding, it will be forcibly killed.

Console

Enable Show Console in the Hero tab to open a standalone log window. Script print() calls and errors appear here.