modchannel.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---@meta
  2. ---ModChannel
  3. -------------
  4. -- An interface to use mod channels on client and server.
  5. ---@class mt.ModChannel
  6. local ModChannel
  7. -- - Server leaves channel `channel_name`.
  8. -- - No more incoming or outgoing messages can be sent to this channel from
  9. -- server mods.
  10. -- - This invalidate all future object usage.
  11. -- - Ensure you set mod_channel to nil after that to free Lua resources.
  12. function ModChannel:leave() end
  13. -- Returns true if channel is writeable and mod can send over it.
  14. ---@return boolean
  15. function ModChannel:is_writeable() end
  16. -- Send `message` though the mod channel.
  17. --
  18. -- - If mod channel is not writeable or invalid, message will be dropped.
  19. -- - Message size is limited to 65535 characters by protocol.
  20. ---@param message string
  21. function ModChannel:send_all(message) end
  22. -- Server joins channel `channel_name`, and creates it if necessary.
  23. --
  24. -- You should listen for incoming messages with
  25. -- `minetest.register_on_modchannel_message`.
  26. ---@param channel_name string
  27. ---@return mt.ModChannel
  28. function minetest.mod_channel_join(channel_name) end