console:registerMethod
Console commands should be registered on the MOD:onInit() function
The command id needs to be unique
void console:registerMethod(command, callback, description, flags)
Registers a new console command
console:registerMethod("my_command", function(args, userID)
if #args <= 1 then return false, "Missing arguments" end
console:print("Awesome " .. args[2], CONSOLE.LOG.DEBUG)
return true, "OK!"
end, "My command description", CONSOLE.FLAGS.CHEATS | CONSOLE.FLAGS.ADMIN) -- Admin only and requires cheats enabled
Parameters
| Type | Name | Description | Optional |
|---|---|---|---|
| string | command | No description | |
| function | callback | fun(args: string[], userID: number): success: boolean, msg: string | |
| string | description | No description | ✔ |
| CONSOLE.FLAGS | flags | No description | ✔ |