Skip to main content

luaur_vm/functions/
lua_close.rs

1//! Node: `cxx:Function:Luau.VM:VM/src/lstate.cpp:292:lua_close`
2//! Source: `VM/src/lstate.cpp:292-297` (hand-ported)
3
4use crate::functions::close_state::close_state;
5use crate::functions::lua_f_close::lua_f_close;
6use crate::type_aliases::lua_state::lua_State;
7
8pub unsafe fn lua_close(L: *mut lua_State) {
9    let L = (*(*L).global).mainthread; // only the main thread can be closed
10    lua_f_close(L, (*L).stack); // close all upvalues for this thread
11    close_state(L);
12}