This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/docs/lua/tables/menu_event.md
Quentin 89f57a9a4c
Lua: can make new tabs from lua scripts, doc generation for available tabs to use (#1593)
* lua api: add globals.get_uint and globals.set_uint

* lua doc: remove duplicate function check as we can overload so it doesn't make sense

* lua doc gen: add support for parsing the tabs enum

* gui: custom lua tabs don't have a `func` rendering function but can still have elements to draw

* lua doc: update generated doc

* chore: code style

* chore: minor spelling mistake

* chore: code style

* gui_service: add runtime removal of tabs

* refactor: make it so that it's less likely defining tabs and their translation key in a wrong way.

* lua api: ability to add custom tabs to the gui from lua
2023-07-05 00:30:57 +02:00

82 lines
1.8 KiB
Markdown

# Table: menu_event
Table containing all possible events to which you can respond.
## Fields (6)
### `PlayerLeave`
Event that is triggered when a player leave the game session.
**Example Usage:**
```lua
event.register_handler(menu_event.PlayerLeave, function (player_name)
log.info(player_name)
end)
```
- Type: `integer`
### `PlayerJoin`
Event that is triggered when a player join the game session.
**Example Usage:**
```lua
event.register_handler(menu_event.PlayerJoin, function (player_name, player_id)
log.info(player_name)
log.info(player_id)
end)
```
- Type: `integer`
### `PlayerMgrInit`
Event that is triggered when the player manager initialize. Usually called when we are joining a session.
**Example Usage:**
```lua
event.register_handler(menu_event.PlayerMgrInit, function ()
log.info("Player manager inited, we just joined a session.")
end)
```
- Type: `integer`
### `PlayerMgrShutdown`
Event that is triggered when the player manager shutdown. Usually called when we are leaving a session.
**Example Usage:**
```lua
event.register_handler(menu_event.PlayerMgrShutdown, function ()
log.info("Player manager inited, we just left a session.")
end)
```
- Type: `integer`
### `ChatMessageReceived`
Event that is triggered when we receive a in-game chat message.
**Example Usage:**
```lua
event.register_handler(menu_event.ChatMessageReceived, function (player_id, chat_message)
log.info(player_id)
log.info(chat_message)
end)
```
- Type: `integer`
### `ScriptedGameEventReceived`
Event that is triggered when we receive a scripted game event.
**Example Usage:**
```lua
event.register_handler(menu_event.ScriptedGameEventReceived, function (player_id, script_event_args)
log.info(player_id)
log.info(script_event_args)
end)
```
- Type: `integer`