From: Felix Fietkau Date: Fri, 14 Nov 2008 16:52:11 +0000 (+0100) Subject: lua: fix uci.set_list X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=5dc61312c1ffc80e730be0bca0bf780a44c55d51;p=uci.git lua: fix uci.set_list --- diff --git a/lua/uci.c b/lua/uci.c index 2d3b972..d9d4ec6 100644 --- a/lua/uci.c +++ b/lua/uci.c @@ -476,12 +476,8 @@ uci_lua_set(lua_State *L) goto error; } - err = uci_set(ctx, &ptr); - if (err) - goto error; - if (istable) { - for (i = 2; i <= lua_objlen(L, nargs); i++) { + for (i = 1; i <= lua_objlen(L, nargs); i++) { lua_rawgeti(L, nargs, i); ptr.value = luaL_checkstring(L, -1); err = uci_add_list(ctx, &ptr); @@ -489,8 +485,13 @@ uci_lua_set(lua_State *L) if (err) goto error; } + } else { + err = uci_set(ctx, &ptr); + if (err) + goto error; } + error: return uci_push_status(L, ctx, false); }