lua: hooks: record the entire 'after' array

Previously we were ignoring the last element in the 'after' arrays
because of a wrong loop limit
This commit is contained in:
George Kiagiadakis
2024-01-08 12:12:31 +02:00
parent 4a3557d8e4
commit 7bd4032a28

View File

@@ -2130,7 +2130,7 @@ simple_event_hook_new (lua_State *L)
if (lua_type (L, 5) == LUA_TTABLE && after_size > 0) {
i = 0;
lua_pushnil (L);
while (lua_next (L, 5) && i < after_size - 1) {
while (lua_next (L, 5) && i < after_size) {
after[i++] = luaL_checkstring (L, -1);
/* bring the key on top without popping the string value */
lua_rotate (L, lua_gettop (L) - 1, 1);
@@ -2379,7 +2379,7 @@ async_event_hook_new (lua_State *L)
if (lua_type (L, 5) == LUA_TTABLE && after_size > 0) {
i = 0;
lua_pushnil (L);
while (lua_next (L, 5) && i < after_size - 1) {
while (lua_next (L, 5) && i < after_size) {
after[i++] = luaL_checkstring (L, -1);
/* bring the key on top without popping the string value */
lua_rotate (L, lua_gettop (L) - 1, 1);