Events (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: Events. Every function of the event 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_event_subscribe |
cl.on(name, fn, opts), cl.once(...) |
both | ANY | 1.0 |
cl_event_unsubscribe |
sub:cancel() |
both | ANY | 1.0 |
cl_event_type_lookup |
cl.event.type_lookup |
both | ANY | 1.0 |
cl_event_name |
cl.event.name |
both | ANY | 1.0 |
cl_event_cancel |
event:cancel() |
both | ANY | 1.0 |
cl_event_is_cancelled |
event:is_cancelled() |
both | ANY | 1.0 |
cl_event_set_result |
event:set_result(r) |
both | ANY | 1.0 |
cl_event_subscribe
cl_result cl_event_subscribe(cl_event_type type, const cl_subscribe_opts* opts, cl_handler_fn fn, void* user, cl_sub* out);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.on(name, fn, opts),cl.once(...) - C++:
clight::events::subscribe(cl_event_type type, const cl_subscribe_opts* opts, cl_handler_fn fn, void* user)→Expected<SubHandle> - 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_event_unsubscribe
cl_result cl_event_unsubscribe(cl_sub sub);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
sub:cancel() - C++:
SubHandle::unsubscribe()→Expected<void>;clight::events::unsubscribe(SubHandle sub)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_event_type_lookup
cl_result cl_event_type_lookup(cl_str id, cl_event_type* out);
“block.break” -> CL_EV_BLOCK_BREAK
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.event.type_lookup - C++:
clight::events::type_lookup(std::string_view id)→Expected<cl_event_type> - 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_event_name
cl_str cl_event_name(cl_event_type type);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.event.name - C++:
clight::events::name(cl_event_type type)→std::string_view
cl_event_cancel
void cl_event_cancel(cl_event_header* h);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
event:cancel() - C++:
clight::events::cancel(cl_event_header* h)→void
cl_event_is_cancelled
bool cl_event_is_cancelled(const cl_event_header* h);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
event:is_cancelled() - C++:
clight::events::is_cancelled(const cl_event_header* h)→bool
cl_event_set_result
void cl_event_set_result(cl_event_header* h, cl_interaction_result r);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
event:set_result(r) - C++:
clight::events::set_result(cl_event_header* h, cl_interaction_result r)→void