EMQ (Eluna Message Queue) is a framework designed to enable communication between map and world states in Eluna.
- Asynchronous message delivery between map and world states.
- Named message queues with custom handlers.
- Minimal and intuitive API.
- Send messages using
player:SendEMQMessage. - Messages are stored in the player’s persistent data.
- A message processor runs on a timer (
1000msby default) to process messages intended for the opposite state. - If a message matches a registered queue name, the associated handler is called.
- Place
EMQ.luain your Lua scripts directory. - Require it in any script that needs messaging:
local EMQ = require("EMQ")
See example.lua
Registers a new queue and its associated handler.
queueName(string): Unique queue name.handlerFunction(player, data)(function): Callback executed when a message is dequeued.
Sends a message to the queue for processing in the opposite state.
queueName(string): Name of a registered queue.data(any): Data passed to the queue handler. Userdata is not supported.
You can adjust the message polling frequency:
EMQ.config.frequency = 1000 -- Poll every 1 seconds