More actions
m TheKillerBunny moved page User:TheKillerBunny/Event to Event: Now I get to be a real page :3 |
use Template:Type? Tag: 2017 source edit |
||
Line 21: | Line 21: | ||
|- | |- | ||
| [[/remove|remove]] | | [[/remove|remove]] | ||
| Takes in a | | Takes in a {{type|string}} with the name of the event, and removes it, stopping it from being called | ||
|- | |- | ||
| [[/clear|clear]] | | [[/clear|clear]] | ||
Line 27: | Line 27: | ||
|- | |- | ||
| [[/register|register]] | | [[/register|register]] | ||
| Takes in a | | Takes in a {{type|function}} to run when the event is fired, with an optional name argument ({{type|string}}) | ||
|- | |- | ||
| [[/getRegisteredCount|getRegisteredCount]] | | [[/getRegisteredCount|getRegisteredCount]] | ||
| Returns the amount of functions registered, with an optional name argument ( | | Returns the amount of functions registered, with an optional name argument ({{type|string}}) | ||
|} | |} | ||
[[Category:Types]] | [[Category:Types]] |
Revision as of 19:29, 26 September 2024
Not to be confused with Events.
The event type is used for events such as events.TICK
. To create an event function, use one of the following.
local tick = 0
function events.WORLD_TICK()
tick = tick + 1
end
-- OR
local tick = 0
events.WORLD_TICK:register(function()
tick = tick + 1
end, "TICK_COUNTER")
Methods
Method | Description |
---|---|
remove | Takes in a string with the name of the event, and removes it, stopping it from being called |
clear | Clears the event of all methods |
register | Takes in a function to run when the event is fired, with an optional name argument (string) |
getRegisteredCount | Returns the amount of functions registered, with an optional name argument (string) |