document register_command

This commit is contained in:
Starbeamrainbowlabs 2024-09-13 02:51:36 +01:00
parent a772f7ed55
commit f09e10ae49
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -5,7 +5,7 @@
-- ██ ██ ███████ ██████ ██ ███████ ██ ███████ ██ ██
--- WorldEditAdditions chat command registration
-- @namespace worldeditadditions_core
-- @module worldeditadditions_core
local wea_c = worldeditadditions_core
local run_command = dofile(wea_c.modpath.."/core/run_command.lua")
@ -13,7 +13,19 @@ local function log_error(cmdname, error_message)
minetest.log("error", "register_command("..cmdname..") error: "..error_message)
end
--- TODO: Document this function
--- Registers a new WorldEditAdditions chat command.
-- @param cmdname string The name of the command to register.
-- @param options table A table of options for the command:
-- - `params` (string) A textual description of the parameters the command takes.
-- - `description` (string) A description of the command.
-- - `privs` (`{someprivilege=true, ....}`) The privileges required to use the command.
-- - `require_pos` (number) The number of positions required for the command.
-- - `parse` (function) A function that parses the raw param_text into proper input arguments to be passed to `nodes_needed` and `func`.
-- - `nodes_needed` (function) A function that returns the number of nodes the command could potential change given the parsed input arguments.
-- - `func` (function) The function to execute when the command is run.
-- - `override=false` (boolean) Whether to override an existing command with the same name.
-- @return boolean True if the command was registered successfully, false otherwise.
local function register_command(cmdname, options)
---