projects
/
oweals
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
00d91c8
)
lua: fix rewriting uci lists
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 20 Jan 2009 00:28:02 +0000
(
01:28
+0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 20 Jan 2009 00:28:02 +0000
(
01:28
+0100)
lua/uci.c
patch
|
blob
|
history
diff --git
a/lua/uci.c
b/lua/uci.c
index 67e9418810d031f042582768fbc81d86215b1c4f..70d02054062ecde669f864329cf07bcfd6a16346 100644
(file)
--- a/
lua/uci.c
+++ b/
lua/uci.c
@@
-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);