diff --git a/include/LuaAPI.h b/include/LuaAPI.h index ca3704d..be88c64 100644 --- a/include/LuaAPI.h +++ b/include/LuaAPI.h @@ -285,7 +285,6 @@ class LuaObject { // 0x14 bytes int GetInteger() const asm("0x907910"); int GetN() const asm("0x907e50"); int GetTableCount() asm("0x90a410"); - int IsPassed() asm("0x907440"); lua_State *GetActiveCState() const asm("0x9072c0"); void AssignBoolean(LuaState *state, bool value) asm("0x909600"); void AssignInteger(LuaState *state, int value) asm("0x909650"); diff --git a/section/Lua/Iterators/IPairs.cxx b/section/Lua/Iterators/IPairs.cxx index db1ac13..760345d 100644 --- a/section/Lua/Iterators/IPairs.cxx +++ b/section/Lua/Iterators/IPairs.cxx @@ -1,10 +1,5 @@ #include "IPairs.h" -IPairsEndIterator::IPairsEndIterator(const LuaObject &table) - : n{table.GetN()} {} - -int IPairsEndIterator::GetN() const { return n; } - IPairsIterator::IPairsIterator(const LuaObject &table) : table{table}, index{0}, value{table.m_state} {} @@ -22,7 +17,7 @@ const std::pair IPairsIterator::operator*() const { std::pair IPairsIterator::operator*() { return {index, value}; } bool IPairsIterator::operator!=(const IPairsEndIterator &end_it) const { - return index <= end_it.GetN(); + return !value.IsNil(); } IPairs::IPairs(const LuaObject &table) : table{table} { @@ -30,4 +25,4 @@ IPairs::IPairs(const LuaObject &table) : table{table} { } IPairsIterator IPairs::begin() { return ++IPairsIterator(table); } -IPairsEndIterator IPairs::end() { return IPairsEndIterator{table}; } +IPairsEndIterator IPairs::end() { return IPairsEndIterator{}; } diff --git a/section/Lua/Iterators/IPairs.h b/section/Lua/Iterators/IPairs.h index 2482968..0bfa06d 100644 --- a/section/Lua/Iterators/IPairs.h +++ b/section/Lua/Iterators/IPairs.h @@ -3,13 +3,6 @@ #include class IPairsEndIterator { -public: - IPairsEndIterator(const LuaObject &table); - - int GetN() const; - -private: - int n; }; class IPairsIterator {