summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-11-14 17:52:11 +0100
committerFelix Fietkau <nbd@openwrt.org>2008-11-14 17:52:11 +0100
commit5dc61312c1ffc80e730be0bca0bf780a44c55d51 (patch)
treecac4672be901b6d8107bfba1e31ba9512032d7fa
parentc79cc497e7b0caa0f9f6a2c978fa9a5f0f097463 (diff)
downloaduci-5dc61312c1ffc80e730be0bca0bf780a44c55d51.tar.gz
lua: fix uci.set_listv0.6.4
-rw-r--r--lua/uci.c11
1 files changed, 6 insertions, 5 deletions
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);
}