yl_template/chatcommands.lua

20 lines
729 B
Lua
Raw Normal View History

2021-11-06 08:33:50 -07:00
local chatcommand_cmd = "example"
local chatcommand_definition = {
params = "<name> <privilege>", -- Short parameter description
description = "Example description", -- Full description
privs = {privs = true}, -- Require the "privs" privilege to run
func = function(name, param)
local success = true
if success then
return true, "Sucess message"
else
return false, "Fail message"
end
end
-- Called when command is run. Returns boolean success and text output.
-- Special case: The help message is shown to the player if `func`
-- returns false without a text output.
}
minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)