summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorElijah Duffy <enduffy2014@outlook.com>2020-10-03 09:38:08 -0700
committerGitHub <noreply@github.com>2020-10-03 17:38:08 +0100
commit7d3641021b755be133dea58404fcb039211fbe52 (patch)
treebd62b4e197492242c84d6e001dfefc8090389b33 /games
parent07500479191ed927ab661b3758ffcd2fd43158c5 (diff)
downloadminetest-7d3641021b755be133dea58404fcb039211fbe52.tar.gz
minetest-7d3641021b755be133dea58404fcb039211fbe52.tar.bz2
minetest-7d3641021b755be133dea58404fcb039211fbe52.zip
Lua API: Add register_on_chatcommand to SSM and CSM (#7862)
Allows catching a chatcommand call just after the command and the parameters are parsed but before its existence is checked and before the corresponding function is run. Returning `true` from a callback function will prevent default handling of the command leaving mods to handle the command manually.
Diffstat (limited to 'games')
-rw-r--r--games/devtest/mods/experimental/commands.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/games/devtest/mods/experimental/commands.lua b/games/devtest/mods/experimental/commands.lua
index 158e5039d..132b08b0b 100644
--- a/games/devtest/mods/experimental/commands.lua
+++ b/games/devtest/mods/experimental/commands.lua
@@ -214,3 +214,6 @@ minetest.register_chatcommand("test_place_nodes", {
end,
})
+core.register_on_chatcommand(function(name, command, params)
+ minetest.log("caught command '"..command.."', issued by '"..name.."'. Parameters: '"..params.."'")
+end)