Minetest-WorldEditAdditions/worldeditadditions_core/register/register.lua
2021-06-30 08:36:04 -07:00

18 lines
445 B
Lua

local we_c = worldeditadditions_core
function we_c.register_command(name, def)
local success, def = we_c.check(def)
if not success then
return false, def
end
minetest.register_chatcommand("/" .. name, {
privs = def.privs,
params = def.params,
description = def.description,
func = function(player_name, param)
return we_c.chatcommand_handler(name, player_name, param)
end,
})
worldedit.registered_commands[name] = def
end