Makeclass cleaned up

This commit is contained in:
2021-02-10 16:22:24 -05:00
parent e838b4ac97
commit 3883f86dee
13 changed files with 120 additions and 54 deletions

View File

@@ -4,10 +4,10 @@
LuaDefine(globaldb_enable, "c") {
LuaVar globaldb;
LuaStack LS(L, globaldb);
LS.getfield(globaldb, LuaRegistry, "globaldb");
LS.rawget(globaldb, LuaRegistry, "globaldb");
if (!LS.istable(globaldb)) {
LS.newtable(globaldb);
LS.setfield(LuaRegistry, "globaldb", globaldb);
LS.rawset(LuaRegistry, "globaldb", globaldb);
}
return LS.result();
}
@@ -26,7 +26,7 @@ LuaDefine(globaldb_global, "f") {
LuaStack LS(L, globalname, globaltab, globaldb);
// Get a pointer to the globaldb.
LS.getfield(globaldb, LuaRegistry, "globaldb");
LS.rawget(globaldb, LuaRegistry, "globaldb");
if (!LS.istable(globaldb)) {
luaL_error(L, "globaldb is not enabled");
}
@@ -44,6 +44,6 @@ LuaDefine(globaldb_global, "f") {
// Create a new globaltab and store it in the globaldb.
LS.newtable(globaltab);
LS.rawset(globaldb, globalname, globaltab);
LS.setfield(globaltab, "__global", globalname);
LS.rawset(globaltab, "__global", globalname);
return LS.result();
}