Lua · Examples

Settings

Read any program setting, and change it with the settings permission.

Each snippet runs as-is: copy it, press From Clipboard on the Lua page, turn it on. Quick start

#Read a setting

No permission needed to read.

settings_1.lua
print("aim fov", config.get("aim.fov"))
print("box colour", json.encode(config.get("esp.visibleColor")))

#Dump a whole section

Prints every key and its live value to the console.

settings_2.lua
for _, sec in ipairs(config.sections()) do
    for _, key in ipairs(config.list(sec)) do
        print(sec .. "." .. key, json.encode(config.get(sec .. "." .. key)))
    end
end

#Toggle a feature with a key

Needs -- permissions: settings and the tick on the script page.

settings_3.lua
-- permissions: settings
ui.keybind("key", "Toggle bunnyhop", 0x76)

function on_frame()
    if input.key_pressed(ui.get("key")) then
        local on = config.get("misc.bunnyhop")
        if config.set("misc.bunnyhop", not on) then
            notify.push("Bunnyhop " .. (on and "off" or "on"))
        end
    end
end

#Animate a colour setting

Colours are {r, g, b, a} from 0 to 1. Up to 64 changes a frame.

settings_4.lua
-- permissions: settings
function on_tick()
    local r, g, b = color.unpack(color.hsv(globals.time() * 60, 0.6, 1))
    config.set("esp.visibleColor", { r / 255, g / 255, b / 255, 1 })
end

Full scripts

Complete scripts with a header and settings, ready to use or change.