mirror of
https://github.com/minetest/minetest.git
synced 2024-12-26 07:57:29 +01:00
6f1c907204
Implement network communication for channels * Implement ModChannel manager server side to route incoming messages from clients to other clients * Add signal handler switch on client & ModChannelMgr on client to handle channels * Add Lua API bindings + client packet sending + unittests * Implement server message sending * Add callback from received message handler to Lua API using registration method
17 lines
497 B
Lua
17 lines
497 B
Lua
--
|
|
-- Mod channels experimental handlers
|
|
--
|
|
local mod_channel = core.mod_channel_join("experimental_preview")
|
|
|
|
core.register_on_modchannel_message(function(channel, sender, message)
|
|
print("[minimal][modchannels] Server received message `" .. message
|
|
.. "` on channel `" .. channel .. "` from sender `" .. sender .. "`")
|
|
|
|
if mod_channel:is_writeable() then
|
|
mod_channel:send_all("experimental answers to preview")
|
|
mod_channel:leave()
|
|
end
|
|
end)
|
|
|
|
print("[minimal][modchannels] Code loaded!")
|