Skip to main content

luaur_code_gen/functions/
on_close_state.rs

1use crate::type_aliases::lua_state::lua_State;
2use luaur_vm::records::lua_execution_callbacks::lua_ExecutionCallbacks;
3
4pub fn on_close_state(L: *mut lua_State) {
5    unsafe {
6        if L.is_null() {
7            return;
8        }
9
10        let l_internal = L as *mut luaur_vm::records::lua_state::lua_State;
11        let global = (*l_internal).global;
12        if !global.is_null() {
13            (*global).ecb = lua_ExecutionCallbacks {
14                context: core::ptr::null_mut(),
15                close: None,
16                destroy: None,
17                enter: None,
18                disable: None,
19                getmemorysize: None,
20                gettypemapping: None,
21                getcounterdata: None,
22                inlinefunction: None,
23            };
24        }
25    }
26}
27
28#[export_name = "on_close_state"]
29pub unsafe extern "C" fn on_close_state_export(L: *mut lua_State) {
30    on_close_state(L);
31}