RmlUi documents (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. 16 functions, the newest from API 1.22.
Explanations and examples: RmlUi. Every function of the rml 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_rml_open |
cl.rml.open |
client | ANY | 1.0 |
cl_rml_close |
cl.rml.close |
client | ANY | 1.0 |
cl_rml_is_open |
cl.rml.is_open |
client | ANY | 1.0 |
cl_rml_set_text |
cl.rml.set_text |
client | ANY | 1.0 |
cl_rml_set_inner_rml |
cl.rml.set_inner_rml |
client | ANY | 1.0 |
cl_rml_set_attribute |
cl.rml.set_attribute |
client | ANY | 1.0 |
cl_rml_set_class |
cl.rml.set_class |
client | ANY | 1.0 |
cl_rml_set_property |
cl.rml.set_property |
client | ANY | 1.0 |
cl_rml_value |
cl.rml.value |
client | ANY | 1.0 |
cl_rml_set_value |
cl.rml.set_value |
client | ANY | 1.0 |
cl_rml_data_set_num |
cl.rml.data_set_num |
client | ANY | 1.22 |
cl_rml_data_set_str |
cl.rml.data_set_str |
client | ANY | 1.22 |
cl_rml_data_set_bool |
cl.rml.data_set_bool |
client | ANY | 1.22 |
cl_rml_data_set_json |
cl.rml.data_set_json |
client | ANY | 1.22 |
cl_rml_data_get_json |
cl.rml.data_get_json |
client | ANY | 1.22 |
cl_rml_shown |
cl.rml.shown |
client | ANY | 1.22 |
cl_rml_open
cl_result cl_rml_open(const cl_rml_desc* desc, cl_rml_doc* out);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.open - C++:
clight::rml::open(const cl_rml_desc* desc)→Expected<RmlDoc> - 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_rml_close
cl_result cl_rml_close(cl_rml_doc doc);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.close,rml_doc:close(...) - C++:
RmlDoc::rml_close()→Expected<void>;clight::rml::close(RmlDoc doc)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_is_open
bool cl_rml_is_open(cl_rml_doc doc);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.is_open,rml_doc:is_open(...) - C++:
RmlDoc::rml_is_open()→bool;clight::rml::is_open(RmlDoc doc)→bool
cl_rml_set_text
cl_result cl_rml_set_text(cl_rml_doc doc, cl_str element_id, cl_str s);
Replaces an element’s content with escaped text.
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_text,rml_doc:set_text(...) - C++:
RmlDoc::rml_set_text(std::string_view element_id, std::string_view s)→Expected<void>;clight::rml::set_text(RmlDoc doc, std::string_view element_id, std::string_view s)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_set_inner_rml
cl_result cl_rml_set_inner_rml(cl_rml_doc doc, cl_str element_id, cl_str rml);
Replaces an element’s content with RML markup (sandboxed: the same file rules apply to src attributes).
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_inner_rml,rml_doc:set_inner_rml(...) - C++:
RmlDoc::rml_set_inner_rml(std::string_view element_id, std::string_view rml)→Expected<void>;clight::rml::set_inner_rml(RmlDoc doc, std::string_view element_id, std::string_view rml)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_set_attribute
cl_result cl_rml_set_attribute(cl_rml_doc doc, cl_str element_id, cl_str name, cl_str value);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_attribute,rml_doc:set_attribute(...) - C++:
RmlDoc::rml_set_attribute(std::string_view element_id, std::string_view name, std::string_view value)→Expected<void>;clight::rml::set_attribute(RmlDoc doc, std::string_view element_id, std::string_view name, std::string_view value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_set_class
cl_result cl_rml_set_class(cl_rml_doc doc, cl_str element_id, cl_str class_name, bool on);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_class,rml_doc:set_class(...) - C++:
RmlDoc::rml_set_class(std::string_view element_id, std::string_view class_name, bool on)→Expected<void>;clight::rml::set_class(RmlDoc doc, std::string_view element_id, std::string_view class_name, bool on)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_set_property
cl_result cl_rml_set_property(cl_rml_doc doc, cl_str element_id, cl_str property, cl_str value);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_property,rml_doc:set_property(...) - C++:
RmlDoc::rml_set_property(std::string_view element_id, std::string_view property, std::string_view value)→Expected<void>;clight::rml::set_property(RmlDoc doc, std::string_view element_id, std::string_view property, std::string_view value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_value
cl_result cl_rml_value(cl_rml_doc doc, cl_str element_id, char* buf, size_t cap, size_t* out_len);
The value of a form control (input, select, textarea).
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.value,rml_doc:value(...) - C++:
RmlDoc::rml_value(std::string_view element_id)→Expected<std::string>;clight::rml::value(RmlDoc doc, std::string_view element_id)→Expected<std::string> - Writes a string:
buf/cap/out_len(a too small buffer returnsCL_E_BUFFER_TOO_SMALLwith the needed length in*out_len). Lua and C++ return the string. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_set_value
cl_result cl_rml_set_value(cl_rml_doc doc, cl_str element_id, cl_str value);
- Side: client. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.rml.set_value,rml_doc:set_value(...) - C++:
RmlDoc::rml_set_value(std::string_view element_id, std::string_view value)→Expected<void>;clight::rml::set_value(RmlDoc doc, std::string_view element_id, std::string_view value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_data_set_num
cl_result cl_rml_data_set_num(cl_rml_doc doc, cl_str name, double value);
The data model of a document (the variables named in rml_desc.model): {{ name }}, data-if, data-for, data-value … update when the mod sets a value (only the views of that variable). Values the player changes through two-way bindings (data-value, data-checked) reach on_event as event “data” with element_id = the variable name.
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.data_set_num,rml_doc:data_set_num(...) - C++:
RmlDoc::rml_data_set_num(std::string_view name, double value)→Expected<void>;clight::rml::data_set_num(RmlDoc doc, std::string_view name, double value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_data_set_str
cl_result cl_rml_data_set_str(cl_rml_doc doc, cl_str name, cl_str value);
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.data_set_str,rml_doc:data_set_str(...) - C++:
RmlDoc::rml_data_set_str(std::string_view name, std::string_view value)→Expected<void>;clight::rml::data_set_str(RmlDoc doc, std::string_view name, std::string_view value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_data_set_bool
cl_result cl_rml_data_set_bool(cl_rml_doc doc, cl_str name, bool value);
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.data_set_bool,rml_doc:data_set_bool(...) - C++:
RmlDoc::rml_data_set_bool(std::string_view name, bool value)→Expected<void>;clight::rml::data_set_bool(RmlDoc doc, std::string_view name, bool value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_data_set_json
cl_result cl_rml_data_set_json(cl_rml_doc doc, cl_str name, cl_str json);
Any value as JSON: lists and objects for data-for and dotted names (items = [{“name”: “Ruby”, “price”: 3}]).
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.data_set_json,rml_doc:data_set_json(...) - C++:
RmlDoc::rml_data_set_json(std::string_view name, std::string_view json)→Expected<void>;clight::rml::data_set_json(RmlDoc doc, std::string_view name, std::string_view json)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_data_get_json
cl_result cl_rml_data_get_json(cl_rml_doc doc, cl_str name, char* buf, size_t cap, size_t* out_len);
The current value as JSON.
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.data_get_json,rml_doc:data_get_json(...) - C++:
RmlDoc::rml_data_get_json(std::string_view name)→Expected<std::string>;clight::rml::data_get_json(RmlDoc doc, std::string_view name)→Expected<std::string> - Writes a string:
buf/cap/out_len(a too small buffer returnsCL_E_BUFFER_TOO_SMALLwith the needed length in*out_len). Lua and C++ return the string. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_rml_shown
bool cl_rml_shown(cl_rml_doc doc);
False while the player hides an overlay (HUD editor, F1), and while a document is not shown.
- Side: client. Context: ANY (any thread). Since: API 1.22.
- Lua:
cl.rml.shown,rml_doc:shown(...) - C++:
RmlDoc::rml_shown()→bool;clight::rml::shown(RmlDoc doc)→bool