Function tlua::push_some_userdata

source ·
pub unsafe fn push_some_userdata<T>(lua: *mut lua_State, value: T)
where T: 'static,
Expand description

Pushes value of type T onto the stack as a userdata. The value is put inside a Option so that it can be safely moved out of there. Useful for example when passing FnOnce as a c closure, because it must be dropped after the call. [0, +1, -]

Safety

There must be enough space on the lua stack for 4 values. The value will be moved into the memory allocated by Lua.