lua-object: always init variable length when iterating object fields.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Mon, 22 Sep 2014 09:58:41 +0000 (12:58 +0300)
committerIsmo Puustinen <ismo.puustinen@intel.com>
Mon, 22 Sep 2014 10:37:06 +0000 (13:37 +0300)
src/core/lua-utils/object.h

index f4a8e50..5638b3a 100644 (file)
 
 
 
+
 #define MRP_LUA_FOREACH_FIELD(_L, _i, _n, _l)                           \
     for (lua_pushnil(_L);                                               \
                                                                         \
-         lua_next(_L, _i) &&                                            \
+         !(_l = 0) && lua_next(_L, _i) &&                               \
          (_n = (lua_type(_L, -2) == LUA_TSTRING) ?                      \
-          lua_tolstring(_L, -2, &_l) : ""       ) &&                    \
-         ((lua_type(_L, -2) == LUA_TSTRING) || !( _l = 0));             \
+          lua_tolstring(_L, -2, &_l) : ""       );                      \
                                                                         \
          lua_pop(_L, 1))