Skip to content

Commit

Permalink
initialize iteratorstates for lua
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoDA committed Feb 25, 2019
1 parent 47330cc commit 5003017
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions framework/luaframework.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ template <typename C> int generateIpairsIterator(lua_State *L)
lua_pushcfunction(L, advanceIpairsIterator<C>);
LuaIteratorState<C> *it =
(LuaIteratorState<C> *)lua_newuserdata(L, sizeof(LuaIteratorState<C>));
it->first = (*v)->begin();
it->second = (*v)->end();
new (it) LuaIteratorState<C>((*v)->begin(), (*v)->end());
lua_pushinteger(L, 0);
return 2;
}
Expand All @@ -371,8 +370,7 @@ template <typename C> int generatePairsIterator(lua_State *L)
lua_pushcfunction(L, advancePairsIterator<C>);
LuaIteratorState<C> *it =
(LuaIteratorState<C> *)lua_newuserdata(L, sizeof(LuaIteratorState<C>));
it->first = (*v)->begin();
it->second = (*v)->end();
new (it) LuaIteratorState<C>((*v)->begin(), (*v)->end());
return 2;
}

Expand Down

0 comments on commit 5003017

Please sign in to comment.