aboutsummaryrefslogtreecommitdiff
path: root/src/compat.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/compat.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compat.cpp b/src/compat.cpp
index 6ceed8f..1d38917 100644
--- a/src/compat.cpp
+++ b/src/compat.cpp
@@ -7,17 +7,17 @@
7 7
8// ################################################################################################# 8// #################################################################################################
9 9
10// a small helper to obtain the "package" module table from the registry instead of relying on the presence of _G.package 10// a small helper to obtain a module's table from the registry instead of relying on the presence of _G["<name>"]
11int luaG_getpackage(lua_State* L_) 11LuaType luaG_getmodule(lua_State* L_, char const* name_)
12{ 12{
13 STACK_CHECK_START_REL(L_, 0); 13 STACK_CHECK_START_REL(L_, 0);
14 int type{ lua503_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) }; // L_: _R._LOADED|nil 14 LuaType type{ static_cast<LuaType>(lua503_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE)) };// L_: _R._LOADED|nil
15 if (type != LUA_TTABLE) { // L_: _R._LOADED|nil 15 if (type != LuaType::TABLE) { // L_: _R._LOADED|nil
16 STACK_CHECK(L_, 1); 16 STACK_CHECK(L_, 1);
17 return type; 17 return type;
18 } 18 }
19 type = lua503_getfield(L_, -1, LUA_LOADLIBNAME); // L_: _R._LOADED package|nil 19 type = static_cast<LuaType>(lua503_getfield(L_, -1, name_)); // L_: _R._LOADED {module}|nil
20 lua_remove(L_, -2); // L_: package|nil 20 lua_remove(L_, -2); // L_: {module}|nil
21 STACK_CHECK(L_, 1); 21 STACK_CHECK(L_, 1);
22 return type; 22 return type;
23} 23}