Lua-based module system #9

Open
opened 2025-11-30 11:31:25 +00:00 by kuschelyagi · 0 comments
Owner

Revamp the module system by throwing away the current TOML based configuration loader and using a lua script to define modules.

Each tqm module (discord, irc, autolink etc) is exported as a lua module, which can be imported with require. The module provides a new function, which takes a config (largely equivalent to the TOML config) returning a table of event handlers as well as other methods specific to that module. For example, discord or irc might have some way to send a message to a server/channel.

Event-producing modules will also return a subscribe method, which can accept any number of other module instances (or just a table with the relevant methods). The idea is that the underlying machinery (the event system, chat connections, and some modules) are written in rust but hooked up by the user in lua.

Revamp the module system by throwing away the current TOML based configuration loader and using a lua script to define modules. Each tqm module (`discord`, `irc`, `autolink` etc) is exported as a lua module, which can be imported with `require`. The module provides a `new` function, which takes a config (largely equivalent to the TOML config) returning a table of event handlers as well as other methods specific to that module. For example, `discord` or `irc` might have some way to send a message to a server/channel. Event-producing modules will also return a `subscribe` method, which can accept any number of other module instances (or just a table with the relevant methods). The idea is that the underlying machinery (the event system, chat connections, and some modules) are written in rust but hooked up by the user in lua.
kuschelyagi added this to the 2026.01 milestone 2025-11-30 11:32:33 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
elsanctum/tenquestionmarks#9
No description provided.