Skip to main content

lumen_app_expose

Function lumen_app_expose 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn lumen_app_expose( app: *mut LumenApp, name: *const c_char, arg_count: u32, func: Option<LumenFn>, user_data: *mut c_void, ) -> LumenStatus
Expand description

Expose a native callback to the app’s script under name. arg_count is the arity (0..=8 sensible); Rhai dispatches on it, Lua and candela bind the call variadically. Pointers are stored by value; the embedder owns user_data and must keep it valid until lumen_app_run returns.

Every script host the app runs gets the registration. A candela script declares what it calls, so it reaches an exposed now_ms as native::now_ms() after declaring host "native" { any now_ms(...); }; Rhai and Lua scripts call now_ms() directly.