Added two new stack disciplines to LuaStack
This commit is contained in:
@@ -21,7 +21,7 @@ int World::number_lua_tables(const IdVector &basis) {
|
||||
// explicit stack (the lua stack).
|
||||
lua_State *L = state();
|
||||
LuaVar tnmap, ntmap, tangibles, tab, key, val, xid;
|
||||
LuaStack LS(L, tnmap, ntmap, tangibles, tab, key, val, xid);
|
||||
LuaOldStack LS(L, tnmap, ntmap, tangibles, tab, key, val, xid);
|
||||
LS.set(tnmap, LuaNewTable);
|
||||
LS.set(ntmap, LuaNewTable);
|
||||
LS.rawset(LuaRegistry, "tnmap", tnmap);
|
||||
@@ -79,8 +79,8 @@ int World::number_lua_tables(const IdVector &basis) {
|
||||
void World::pair_lua_tables(const IdVector &basis, lua_State *master) {
|
||||
lua_State *synch = state();
|
||||
LuaVar stangibles, mtangibles, sntmap, mntmap, stnmap, mtnmap, stab, mtab, skey, mkey, sval, mval, sidx, midx;
|
||||
LuaStack SLS(synch, stangibles, stab, skey, sval, sntmap, stnmap, sidx);
|
||||
LuaStack MLS(master, mtangibles, mtab, mkey, mval, mntmap, mtnmap, midx);
|
||||
LuaOldStack SLS(synch, stangibles, stab, skey, sval, sntmap, stnmap, sidx);
|
||||
LuaOldStack MLS(master, mtangibles, mtab, mkey, mval, mntmap, mtnmap, midx);
|
||||
|
||||
// Fetch the tangible databases
|
||||
SLS.rawget(stangibles, LuaRegistry, "tangibles");
|
||||
@@ -178,7 +178,7 @@ int World::number_remaining_tables(const IdVector &basis, lua_State *master) {
|
||||
// explicit stack (the lua stack).
|
||||
lua_State *L = master;
|
||||
LuaVar tnmap, ntmap, tangibles, tab, key, val, xid;
|
||||
LuaStack LS(L, tnmap, ntmap, tangibles, tab, key, val, xid);
|
||||
LuaOldStack LS(L, tnmap, ntmap, tangibles, tab, key, val, xid);
|
||||
LS.rawget(tnmap, LuaRegistry, "tnmap");
|
||||
LS.rawget(ntmap, LuaRegistry, "ntmap");
|
||||
LS.rawget(tangibles, LuaRegistry, "tangibles");
|
||||
@@ -242,7 +242,7 @@ int World::number_remaining_tables(const IdVector &basis, lua_State *master) {
|
||||
|
||||
void World::create_new_tables(int n) {
|
||||
LuaVar tnmap, ntmap, tab;
|
||||
LuaStack LS(state(), tnmap, ntmap, tab);
|
||||
LuaOldStack LS(state(), tnmap, ntmap, tab);
|
||||
LS.rawget(tnmap, LuaRegistry, "tnmap");
|
||||
LS.rawget(ntmap, LuaRegistry, "ntmap");
|
||||
assert(LS.istable(tnmap));
|
||||
@@ -261,7 +261,7 @@ void World::create_new_tables(int n) {
|
||||
|
||||
void World::unnumber_lua_tables() {
|
||||
// All we have to do is remove these tables from the registry.
|
||||
LuaStack LS(state());
|
||||
LuaOldStack LS(state());
|
||||
LS.rawset(LuaRegistry, "tnmap", LuaNil);
|
||||
LS.rawset(LuaRegistry, "ntmap", LuaNil);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user