Start typing to search packages!
event
By @rt0mmy
Roblox
MirroredEvent
Fast & Lightweight Luau scriptevent
Warning
Event is under development
Why Event?
Event is an API meticulously crafted to simplify event management, making your code more readable, maintainable, and responsive; It's lightweight and straightforward structure makes it extremly easy to implement into your workflow.
Event offers intuitive and clean API structure, designed to minimize complexity while maximizing functionality.
Empower your projects with the blazing fast Event
API
local Event = require(...)
Creating a new
EventObject
Event() -> Event
local newEvent = Event()
Creating a new
Connectionfor the specifiedEvent
EventObject:Connect(Callback: (T...)) -> Connection
local newConnection = EventObject:Connect(function(a: number, b: number)
print(a + b)
end)
Creating a new single-use
Connectionfor the specifiedEvent
EventObject:Once(Callback: (T...)) -> Connection
local newConnection = EventObject:Once(function(a: number, b: number)
print(a + b)
end)
Creating a new asynchronous
Connectionfor the specifiedEvent, thus yielding the runtime code until the event is triggered. An optionaltimeoutargument defines how long the code will yield until the Wait method is terminated and therefore fails.
EventObject:Wait(timeout: number?) -> Connection
local success = EventObject:Wait(2)
print(success)
Disconnects the
Connectionfrom Event
ConnectionObject()
newConnection()
Fires the event, triggering all
Connections (Callbacks)
EventObject:Fire(T...) -> nil
EventObject:Fire("Hello World!", "\n Luau is great!")
Terminates all
Connections from theEvent
EventObject:DisconnectAll() -> nil
EventObject:DisconnectAll()
Destroys
Event, therefore also disconnects allConnections
EventObject:Destroy() -> nil
EventObject:Destroy()
API Sample Demo
local Event = require(...)
local newEvent = Event()
local newEventConnection = newEvent:Connect(function(...string)
print(...)
end)
newEvent:Fire("Hello", "World") -- // -> Hello World
newEventConnection()
newEvent:Fire("Hello", "World 2") -- // Doesn't print "Hell World 2", because the ConnectionObject "newEventConnection" was disconnected beforehand.
local Event = require(...)
local EventProcessAB = Event()
function ProcessAB()
local v = EventProcessAB:Wait(4)
if v then
print('A + B = '..v)
else
print('failed to deliver :(')
end
end
-- Script A
local Event = require(...)
local ClientEvents = {
onClientDead = Event(),
onClientDamaged = Event(),
onClientStatusChanged = Event()
}
return ClientEvents
-- Script B
local ClientEvents = require(ScriptA...)
local function TakeDamage(n)
...
ClientEvents.onClientDamaged:Fire(n)
if Client.Health <= 0 then
ClientEvents.onClientDead:Fire()
end
...
end
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
