From 7d3641021b755be133dea58404fcb039211fbe52 Mon Sep 17 00:00:00 2001 From: Elijah Duffy Date: Sat, 3 Oct 2020 09:38:08 -0700 Subject: 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. --- doc/client_lua_api.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/client_lua_api.txt') 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))` -- cgit v1.2.3