mirror of
https://github.com/HybridDog/we_undo.git
synced 2024-12-12 17:13:16 +01:00
Show all available chatcommands when the desired one was not found
This commit is contained in:
parent
1129cb1601
commit
e53175df55
9
init.lua
9
init.lua
@ -18,7 +18,14 @@ local command_invoker
|
||||
|
||||
local function override_chatcommand(cname, func_before, func_after)
|
||||
local command = minetest.registered_chatcommands[cname]
|
||||
assert(command, "Chatcommand " .. cname .. " isn't registered.")
|
||||
if not command then
|
||||
local cmds = {}
|
||||
for name in pairs(minetest.registered_chatcommands) do
|
||||
cmds[#cmds+1] = name
|
||||
end
|
||||
error("Chatcommand " .. cname .. " is not registered.\n" ..
|
||||
"Available commands: " .. table.concat(cmds, ", "))
|
||||
end
|
||||
-- save the name of the player and execute func_before if present
|
||||
if func_before then
|
||||
local func = command.func
|
||||
|
Loading…
Reference in New Issue
Block a user