minetest.register on receiving chat messages

From Minetest Developer Wiki
Jump to: navigation, search

Syntax

minetest.register_on_receiving_chat_messages(function(message))

Description

Called always after a chat message was obtained from server. Note that it ignores the motd.
If the function returns true, the message is not displayed. See also minetest.display_chat_message.

Example

local recfuncs = minetest.registered_on_receiving_chat_messages
 
local fnum = #recfuncs+1
 
-- Change the way the message is shown
recfuncs[fnum] = function(message)
	minetest.display_chat_message("Message recieved: " .. message)
	-- Execute later registered functions
	for i = fnum+1, #recfuncs do
		if recfuncs[i](message) == true then
			error"Can't properly handle chat message"
		end
	end
	return true
end
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox