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_by_fov(5.0, 50.0)
    if not target or not target:is_targetable() then return end

    local lp = local_player()
    if not lp then return end

    if lp:is_ability_ready(slot.ability2) then
        if snap_to_target(target, { bone = bone.spine_1 }) then
            press_ability(slot.ability2)
        end
    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.