Deprecate Lua::load_from_finction and replace it with Lua::register_module and Lua::preload_module instead.

This commit is contained in:
Alex Orlenko
2025-04-26 13:38:13 +01:00
parent a8a4aa8c93
commit 64b1d152b9
6 changed files with 146 additions and 67 deletions
+1 -1
View File
@@ -548,7 +548,7 @@ pub unsafe fn luaL_getsubtable(L: *mut lua_State, idx: c_int, fname: *const c_ch
pub unsafe fn luaL_requiref(L: *mut lua_State, modname: *const c_char, openf: lua_CFunction, glb: c_int) {
luaL_checkstack(L, 3, cstr!("not enough stack slots available"));
luaL_getsubtable(L, LUA_REGISTRYINDEX, cstr!("_LOADED"));
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
if lua_getfield(L, -1, modname) == LUA_TNIL {
lua_pop(L, 1);
lua_pushcfunction(L, openf);