Container menus (function list)
Status: Implemented (API 1.24). Generated from
client/clight/idl/clight_api.jsonbytools/docs/gen_api_reference.py; do not edit by hand. 7 functions, the newest from API 1.0.
Explanations and examples: Inventories and menus. Every function of the menu module is listed here in table order.
The details of each function follow the table, in the same order. Side: where the function works (server, client, both). Context: the thread it may be called on (Conventions). Since: the API version that added it.
| C function | Lua | Side | Context | Since |
|---|---|---|---|---|
cl_menu_open |
cl.menu.open |
server | TICK | 1.0 |
cl_menu_close |
cl.menu.close |
server | TICK | 1.0 |
cl_menu_is_open |
cl.menu.is_open |
server | TICK | 1.0 |
cl_menu_player |
cl.menu.player |
server | TICK | 1.0 |
cl_menu_size |
cl.menu.size |
server | TICK | 1.0 |
cl_menu_set_item |
cl.menu.set_item |
server | TICK | 1.0 |
cl_menu_get_item |
cl.menu.get_item |
server | TICK | 1.0 |
cl_menu_open
cl_result cl_menu_open(cl_entity player, const cl_menu_desc* desc, cl_menu* out);
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.open,entity:open(...) - C++:
Entity::menu_open(const cl_menu_desc* desc)→Expected<Menu>;clight::menu::open(Entity player, const cl_menu_desc* desc)→Expected<Menu> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_menu_close
cl_result cl_menu_close(cl_menu m);
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.close,menu:close(...) - C++:
Menu::close()→Expected<void>;clight::menu::close(Menu m)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_menu_is_open
bool cl_menu_is_open(cl_menu m);
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.is_open,menu:is_open(...) - C++:
Menu::is_open()→bool;clight::menu::is_open(Menu m)→bool
cl_menu_player
cl_entity cl_menu_player(cl_menu m);
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.player,menu:player(...) - C++:
Menu::player()→Entity;clight::menu::player(Menu m)→Entity
cl_menu_size
int32_t cl_menu_size(cl_menu m);
Number of container slots (without the player inventory).
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.size,menu:size(...) - C++:
Menu::size()→int32_t;clight::menu::size(Menu m)→int32_t
cl_menu_set_item
cl_result cl_menu_set_item(cl_menu m, int32_t slot, cl_item_stack stack);
Copies the stack into the slot (no ownership taken) and syncs it to the client.
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.set_item,menu:set_item(...) - C++:
Menu::set_item(int32_t slot, cl_item_stack stack)→Expected<void>;clight::menu::set_item(Menu m, int32_t slot, cl_item_stack stack)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_menu_get_item
cl_item_stack cl_menu_get_item(cl_menu m, int32_t slot);
- Side: server. Context: TICK (tick thread). Since: API 1.0.
- Lua:
cl.menu.get_item,menu:get_item(...) - C++:
Menu::get_item(int32_t slot)→ItemStack;clight::menu::get_item(Menu m, int32_t slot)→ItemStack - The returned handle is owned: release it ©, or let the RAII class do it (C++). Lua releases it when it is collected (or at once with
local s <close> = ...).