Skip to content

Commit 67b4d3d

Browse files
committed
Fix method LuaValue::lenght() for Lua 5.2 (#12)
1 parent e80f953 commit 67b4d3d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/LuaValue.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ namespace lua {
346346
}
347347

348348
int length() const {
349+
#if LUA_VERSION_NUM > 501
350+
return lua_rawlen(_stack->state, _stack->top + _stack->pushed - _stack->grouped);
351+
#else
349352
return lua_objlen(_stack->state, _stack->top + _stack->pushed - _stack->grouped);
353+
#endif
350354
}
351355

352356
template<typename K>

0 commit comments

Comments
 (0)