Changed calling conventions again

This commit is contained in:
2020-12-05 18:57:53 -05:00
parent 150a71433b
commit c751678179
14 changed files with 403 additions and 219 deletions

View File

@@ -1,3 +1,4 @@
#include "luastack.hpp"
#include "globaldb.hpp"
#include "table.hpp"
@@ -8,7 +9,7 @@
// if globalname is already present, and not a table, error.
// if globalname is not present, create and initialize it.
//
int lpx_globaldb_global(lua_State *L) {
LuaDefineGlobalFunction(globaldb_global) {
LuaArg globalname;
LuaRet globaltab;
LuaVar globaldb;
@@ -17,10 +18,10 @@ int lpx_globaldb_global(lua_State *L) {
LS.checktype(globalname, LUA_TSTRING);
// Get a pointer to the globaldb.
LS.getfield(globaldb, LUA_REGISTRYINDEX, "globaldb");
LS.getfield(globaldb, LuaRegistry, "globaldb");
if (!LS.istable(globaldb)) {
LS.newtable(globaldb);
LS.setfield(LUA_REGISTRYINDEX, "globaldb", globaldb);
LS.setfield(LuaRegistry, "globaldb", globaldb);
}
// Get the globaltab from the globaldb, sanity check it.
@@ -37,7 +38,3 @@ int lpx_globaldb_global(lua_State *L) {
LS.setfield(globaltab, "__global", globalname);
return LS.result();
}
void luaopen_lpx_globaldb(lua_State *L) {
LuaStack::reg(L, 0, "global", LuaArgCheck<1, lpx_globaldb_global>);
}