summaryrefslogtreecommitdiff
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/client_lua_api.txt5
-rw-r--r--doc/lua_api.txt5
2 files changed, 10 insertions, 0 deletions
diff --git a/doc/client_lua_api.txt b/doc/client_lua_api.txt
index 4c5231b79..32be2fabf 100644
--- a/doc/client_lua_api.txt
+++ b/doc/client_lua_api.txt
@@ -686,6 +686,11 @@ Call these functions only at load time!
* Adds definition to minetest.registered_chatcommands
* `minetest.unregister_chatcommand(name)`
* Unregisters a chatcommands registered with register_chatcommand.
+* `minetest.register_on_chatcommand(function(command, params))`
+ * Called always when a chatcommand is triggered, before `minetest.registered_chatcommands`
+ is checked to see if that the command exists, but after the input is parsed.
+ * Return `true` to mark the command as handled, which means that the default
+ handlers will be prevented.
* `minetest.register_on_death(function())`
* Called when the local player dies
* `minetest.register_on_hp_modification(function(hp))`
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index edacfe05f..e8eb403c4 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -4606,6 +4606,11 @@ Call these functions only at load time!
* Called always when a player says something
* Return `true` to mark the message as handled, which means that it will
not be sent to other players.
+* `minetest.register_on_chatcommand(function(name, command, params))`
+ * Called always when a chatcommand is triggered, before `minetest.registered_chatcommands`
+ is checked to see if the command exists, but after the input is parsed.
+ * Return `true` to mark the command as handled, which means that the default
+ handlers will be prevented.
* `minetest.register_on_player_receive_fields(function(player, formname, fields))`
* Called when the server received input from `player` in a formspec with
the given `formname`. Specifically, this is called on any of the