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. --- games/devtest/mods/experimental/commands.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'games') 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) -- cgit v1.2.3