mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
update doc/*/scripting/events.md
This commit is contained in:
parent
72d5eca632
commit
a47bdc0409
2 changed files with 42 additions and 0 deletions
|
|
@ -136,3 +136,24 @@ function on_hud_close(playerid: int)
|
|||
```
|
||||
|
||||
Called on world close (before saving)
|
||||
|
||||
## *events* library
|
||||
|
||||
```lua
|
||||
events.on(code: str, handler: function)
|
||||
```
|
||||
|
||||
Adds an event handler by its code, not limited to the standard ones.
|
||||
|
||||
```lua
|
||||
events.emit(code: str, args...) -> bool
|
||||
```
|
||||
|
||||
Emits an event by code. If the event does not exist, nothing will happen.
|
||||
The existence of an event is determined by the presence of handlers.
|
||||
|
||||
```lua
|
||||
events.unload(packid: str)
|
||||
```
|
||||
|
||||
Removes all events with the prefix `packid:`. When you exit the world, events from all packs are unloaded, including `core:`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue