More work refactoring ckint/tryint/isint

This commit is contained in:
2024-03-15 12:50:08 -04:00
parent 26d0715deb
commit 3d6b5224f3
4 changed files with 64 additions and 51 deletions

View File

@@ -139,13 +139,13 @@ void World::pair_lua_tables(const IdVector &basis, lua_State *master) {
if (MLS.isnumber(midx)) continue;
// If the synch table doesn't have a number, skip.
SLS.rawget(sidx, stnmap, stab);
if (!SLS.isnumber(sidx)) continue;
int idx = SLS.ckinteger(sidx);
assert((idx >= 1) && (idx <= s_ntables));
auto idx = SLS.trynumber(sidx);
if (!idx) continue;
assert((*idx >= 1) && (*idx <= s_ntables));
// Pair the tables.
MLS.rawset(mtnmap, mtab, idx);
MLS.rawset(mntmap, idx, mtab);
paired[idx] = true;
MLS.rawset(mtnmap, mtab, *idx);
MLS.rawset(mntmap, *idx, mtab);
paired[*idx] = true;
// Potentially pair the metatables.
MLS.getmetatable(mval, mtab);
if (MLS.istable(mval)) {