mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
lua: fix __next, must return 2 values
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
a921f60510
commit
c4999bd59d
1 changed files with 10 additions and 2 deletions
12
lua.h
12
lua.h
|
@ -315,12 +315,20 @@ luaA_generic_pairs(lua_State *L)
|
|||
{ \
|
||||
int idx = lua_tonumber(L, 2); \
|
||||
if(idx >= 0 && idx < value->len) \
|
||||
return ctor(L, value->tab[idx]); \
|
||||
{ \
|
||||
lua_pushnumber(L, idx + 1); \
|
||||
ctor(L, value->tab[idx]); \
|
||||
return 2; \
|
||||
} \
|
||||
} \
|
||||
else if(lua_isnil(L, 2)) \
|
||||
{ \
|
||||
if(value->len) \
|
||||
return ctor(L, value->tab[0]); \
|
||||
{ \
|
||||
lua_pushnumber(L, 1); \
|
||||
ctor(L, value->tab[0]); \
|
||||
return 2; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
return 0; \
|
||||
|
|
Loading…
Reference in a new issue