diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-01-20 01:28:02 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-01-20 01:28:02 +0100 |
commit | cd9311c8d6b7432f507e9eed12587c971875a9de (patch) | |
tree | e2d912e652fc7602b97d9f40ce3307e245a4c5bb | |
parent | 00d91c8ca4a5d35d5c3706d0042f0e57cefa3d12 (diff) | |
download | uci-0.7.2.tar.gz |
lua: fix rewriting uci listsv0.7.2
-rw-r--r-- | lua/uci.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -527,7 +527,18 @@ uci_lua_set(lua_State *L) } if (istable) { - for (i = 1; i <= lua_objlen(L, nargs); i++) { + if (lua_objlen(L, nargs) == 1) { + i = 1; + if (ptr.o) + err = uci_delete(ctx, &ptr); + } else { + i = 2; + err = uci_set(ctx, &ptr); + if (err) + goto error; + } + + for (; i <= lua_objlen(L, nargs); i++) { lua_rawgeti(L, nargs, i); ptr.value = luaL_checkstring(L, -1); err = uci_add_list(ctx, &ptr); |