Description
Provides functionality similar to Luau's (variant of Lua used by Roblox) events system - including the function disconnection return!
Basically gives developers a (hopefully) easy way of setting up and running events - as well as making it easy to set up a function for registering functions to call when the event occurs!
events_api.create(name) provides a table of information: funcs (list of functions to be ran), register (for adding functions to the funcs list), and handler (function for running the event, and calling all of the functions inside the funcs). Provides name as a field also - which will be the string that it was registered with
It can have an additional definition argument as so:
events_api.create(name, def)
Which helps set up slightly more in-depth setup with your mod. Be sure to read the API doc for more info! https://codeberg.org/TPH/events_api/src/branch/master/api.md
Utilized by my tph_wielditem mod: https://content.luanti.org/packages/TPH/tph_wielditem/
Functionally similar to https://content.luanti.org/packages/Sumianvoice/asignals/
Releases
2026-02-12 00:15 UTC
2 - new API + event callbacks
2 new API functions:
is_nil(val) - used for checking whether or not a provided value is "nil" (either nil or a null string character \0)
convert_variable_args(...) - converts a tuple into a table array that preserves the positions of nil as null string character \0
2 new event callbacks
-
event.after_event - ran after ALL event.funcs have been called by event.handler(...). First parameter (funcsdata) is a list of funcdata that contain an id (table index in data.funcs), func (actual function), and returned (values returned by called function, respects positions of nil with null string character \0). Other parameters will be the tuple provided by event.handler(...). Good for being used in implementations similar to core.register_on_placenode`, doing unique things depending on what a function returns
-
event.prior_to_each_handler_func - ran prior to EACH AND EVERY function in events.funcs. First parameter funcdata is a table that contains an id (table index in data.funcs) and func (actual function). Other parameters will be the tuple provided by event.handler(...). Can be used for randomizing fields or cloning tables on a per-function basis. Expects same return tuple order of the events.handler function (unless you've programmed this purposefully to do something different, why?)
2025-09-16 01:21 UTC
Initialization - first release!
Creates the essential basics of the mod's functionality - events_api.create which returns a table with funcs array, handler function, and register function
Disconnection function return for event.register(func)
All releases
Threads
New thread
Information
Provides
events_api
Dependencies
- Required
-
No required dependencies
Information
- Type
- Mod
- Technical Name
- events_api
- Languages
-
English
- License
-
MIT
- Maintenance State
- Beta
- Added
- 2025-09-16 01:18 UTC
- Maintainers
-
TPH
Used By