yl_scheduler/chatcommand_scheduler_add.lua
2024-04-09 17:21:44 +02:00

24 lines
836 B
Lua

local chatcommand_cmd = "scheduler_add"
local chatcommand_params =
"<time$function$[param1, param2, param3, ...][$notes]>"
local chatcommand_description =
"Adds a new task that executes a function with params at the given time. See /" ..
chatcommand_cmd .. " help"
local chatcommand_definition = {
params = chatcommand_params,
description = chatcommand_description,
privs = yl_scheduler.get_privs(chatcommand_cmd),
func = function(name, params)
local success, message = yl_scheduler["cmd_" .. chatcommand_cmd](name,
params)
if success then
return true, message
else
return false, message
end
end
}
minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)