Skip to content

HUD (function list)

Status: Implemented (API 1.24). Generated from client/clight/idl/clight_api.json by tools/docs/gen_api_reference.py; do not edit by hand. 9 functions, the newest from API 1.21.

Explanations and examples: HUD. Every function of the hud 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_hud_layer_register cl.hud.layer_register client ANY 1.0
cl_hud_layer_remove cl.hud.layer_remove client ANY 1.0
cl_hud_left_height cl.hud.left_height client RENDER 1.0
cl_hud_right_height cl.hud.right_height client RENDER 1.0
cl_hud_element_register cl.hud.element_register client ANY 1.21
cl_hud_element_remove cl.hud.element_remove client ANY 1.21
cl_hud_element_set_size cl.hud.element_set_size client ANY 1.21
cl_hud_element_invalidate cl.hud.element_invalidate client ANY 1.21
cl_hud_element_shown cl.hud.element_shown client ANY 1.21

cl_hud_layer_register

cl_result cl_hud_layer_register(const cl_hud_layer_desc* desc, cl_hud_layer* out);
  • Side: client. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.hud.layer_register
  • C++: clight::hud::layer_register(const cl_hud_layer_desc* desc) → Expected<HudLayer>
  • The last parameter receives the result. Lua returns it; C++ returns it in Expected<T>.
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_layer_remove

cl_result cl_hud_layer_remove(cl_hud_layer layer);
  • Side: client. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.hud.layer_remove, hud_layer:remove(...)
  • C++: HudLayer::remove()
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_left_height

int32_t cl_hud_left_height(void);

The height the vanilla left/right status bars use above the hotbar (health+armor / food+air), so layers can stack above them like vanilla’s Gui#leftHeight/rightHeight.

  • Side: client. Context: RENDER (render thread). Since: API 1.0.
  • Lua: cl.hud.left_height
  • C++: clight::hud::left_height() → int32_t

cl_hud_right_height

int32_t cl_hud_right_height(void);
  • Side: client. Context: RENDER (render thread). Since: API 1.0.
  • Lua: cl.hud.right_height
  • C++: clight::hud::right_height() → int32_t

cl_hud_element_register

cl_result cl_hud_element_register(const cl_hud_element_desc* desc, cl_hud_element* out);
  • Side: client. Context: ANY (any thread). Since: API 1.21.
  • Lua: cl.hud.element_register
  • C++: clight::hud::element_register(const cl_hud_element_desc* desc) → Expected<HudElement>
  • The last parameter receives the result. Lua returns it; C++ returns it in Expected<T>.
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_element_remove

cl_result cl_hud_element_remove(cl_hud_element e);
  • Side: client. Context: ANY (any thread). Since: API 1.21.
  • Lua: cl.hud.element_remove, hud_element:remove(...)
  • C++: HudElement::remove() → Expected<void>; clight::hud::element_remove(HudElement e) → Expected<void>
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_element_set_size

cl_result cl_hud_element_set_size(cl_hud_element e, int32_t width, int32_t height);

A new box size (a longer text …).

  • Side: client. Context: ANY (any thread). Since: API 1.21.
  • Lua: cl.hud.element_set_size, hud_element:set_size(...)
  • C++: HudElement::set_size(int32_t width, int32_t height) → Expected<void>; clight::hud::element_set_size(HudElement e, int32_t width, int32_t height) → Expected<void>
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_element_invalidate

cl_result cl_hud_element_invalidate(cl_hud_element e);

Cached elements: draw again on the next frame (the content changed).

  • Side: client. Context: ANY (any thread). Since: API 1.21.
  • Lua: cl.hud.element_invalidate, hud_element:invalidate(...)
  • C++: HudElement::invalidate() → Expected<void>; clight::hud::element_invalidate(HudElement e) → Expected<void>
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_hud_element_shown

bool cl_hud_element_shown(cl_hud_element e);

False while the player has hidden the element.

  • Side: client. Context: ANY (any thread). Since: API 1.21.
  • Lua: cl.hud.element_shown, hud_element:shown(...)
  • C++: HudElement::shown() → bool; clight::hud::element_shown(HudElement e) → bool