util.input.list

Client

Retrieves the names of all currently registered console commands


Syntax

local commands = util.input.list()

Names only — not the handlers themselves.

  • Unordered — backed by a hash map, so iteration order won't match registration order.
  • Read-only — safe to call anytime; has no effect on registered handlers.
  • All environments — includes commands registered by every resource's script, not just the caller's own.

Parameters

No parameters are accepted by this function

Returns

TypeNameDescription
string[]commandsArray of registered command name strings

Examples

Print all registered commands
for i, name in ipairs(util.input.list()) do
    core.engine.print("info", i, name)
end
Check whether a command is currently registered
local function is_registered(name)
    for _, cmd in ipairs(util.input.list()) do
        if cmd == name then return true end
    end
    return false
end

if is_registered("teleport") then
    core.engine.print("info", "teleport command is available")
end

On this page