The check for nil on the 2nd argument misses the offset in order to skip over
implicit self which results in
`bad argument #2 to 'foreach' (string expected, got nil)`
when invoking `uci.cursor():foreach("test", nil, function(s) end)`.
The same call works fine when using dot instead of colon notation.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
ctx = find_context(L, &offset);
package = luaL_checkstring(L, 1 + offset);
- if (lua_isnil(L, 2))
+ if (lua_isnil(L, 2 + offset))
type = NULL;
else
type = luaL_checkstring(L, 2 + offset);