mirror of
https://github.com/HybridDog/we_undo.git
synced 2025-01-06 12:47:35 +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 function override_chatcommand(cname, func_before, func_after)
|
||||||
local command = minetest.registered_chatcommands[cname]
|
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
|
-- save the name of the player and execute func_before if present
|
||||||
if func_before then
|
if func_before then
|
||||||
local func = command.func
|
local func = command.func
|
||||||
|
Loading…
Reference in New Issue
Block a user