Skip to content

Commit

Permalink
Treat result of LuaL_len as int regardless
Browse files Browse the repository at this point in the history
Since other part of lua-intf already doing the cast, let's make the code
more consistent.
  • Loading branch information
SteveKChiu committed Mar 18, 2016
1 parent 78ada90 commit d6f17a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions LuaIntf/LuaState.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ namespace Lua
{
luaL_checktype(L, index, LUA_TTABLE);
LIST list;
auto n = luaL_len(L, index);
for (auto i = 1; i <= n; i++) {
int n = int(luaL_len(L, index));
for (int i = 1; i <= n; i++) {
lua_rawgeti(L, index, i);
list.push_back(pop<typename LIST::value_type>(L));
}
Expand Down
2 changes: 1 addition & 1 deletion LuaIntf/src/LuaCompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ LUA_INLINE int luaL_len(lua_State* L, int i)
luaL_checkstack(L, 1, "not enough stack slots");
lua_len(L, i);
int is_num = 0;
int res = (int)lua_tointegerx(L, -1, &is_num);
int res = int(lua_tointegerx(L, -1, &is_num));
lua_pop(L, 1);
if (!is_num) {
luaL_error(L, "object length is not a number");
Expand Down

0 comments on commit d6f17a8

Please sign in to comment.