lua: remove pointless double check of autoload flag
[project/uci.git] / lua / uci.c
index 6ba7da07f9e8793f2b1e54ddda6ff60c120a55fe..47d59c883ab9320b39304fdd46297576c3550fa1 100644 (file)
--- a/lua/uci.c
+++ b/lua/uci.c
@@ -113,11 +113,8 @@ find_package(lua_State *L, struct uci_context *ctx, const char *str, bool al)
                goto done;
        }
 
-       if (al == true)
+       if (al)
                uci_load(ctx, name, &p);
-       else if (al) {
-               uci_load(ctx, name, &p);
-       }
 
 done:
        if (name != str)
@@ -303,7 +300,7 @@ uci_lua_foreach(lua_State *L)
        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);