core: fix register_command and run_command

This commit is contained in:
Starbeamrainbowlabs 2022-05-19 02:40:05 +01:00
parent 95c0e96da9
commit c53fb32d2b
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 4 additions and 2 deletions

View file

@ -25,11 +25,11 @@ local function register_command(cmdname, options)
log_error(cmdname, "The description option is not a string.")
return false
end
if type(options.parse) ~= "string" then
if type(options.parse) ~= "function" then
log_error(cmdname, "The parse option is not a function.")
return false
end
if type(options.func) ~= "string" then
if type(options.func) ~= "function" then
log_error(cmdname, "The func option is not a function.")
return false
end

View file

@ -43,6 +43,8 @@ local function run_command(cmdname, options, player_name, paramtext)
safe_region(player_name, cmdname, function()
run_command_stage2(player_name, options.func, parse_result)
end)
else
run_command_stage2(player_name, options.func, parse_result)
end
else
run_command_stage2(player_name, options.func, parse_result)