--- /dev/null
+--- a/lua/uci.c
++++ b/lua/uci.c
+@@ -691,6 +691,7 @@ uci_lua_add_change(lua_State *L, struct
+ {
+ struct uci_history *h;
+ const char *name;
++ const char *value;
+
+ h = uci_to_history(e);
+ if (!h->section)
+@@ -704,12 +705,38 @@ uci_lua_add_change(lua_State *L, struct
+ lua_setfield(L, -3, h->section);
+ }
+
+- name = (h->e.name ? h->e.name : ".type");
+- if (h->value)
+- lua_pushstring(L, h->value);
+- else
+- lua_pushstring(L, "");
+- lua_setfield(L, -2, name);
++ name = h->e.name;
++ value = h->value ? h->value : "";
++
++ if (name) {
++ lua_getfield(L, -1, name);
++
++ /* there seems to be no value yet */
++ if (lua_isnil(L, -1)) {
++ /* this delta is a list add operation, initialize table */
++ if (h->cmd == UCI_CMD_LIST_ADD) {
++ lua_newtable(L);
++ lua_pushstring(L, value);
++ lua_rawseti(L, -2, 1);
++ lua_setfield(L, -3, name);
++ } else {
++ lua_pushstring(L, value);
++ lua_setfield(L, -3, name);
++ }
++
++ /* a table is on the top of the stack so this is a subsequent,
++ * list_add, append this value to table */
++ } else if (lua_istable(L, -1)) {
++ lua_pushstring(L, value);
++ lua_rawseti(L, -2, lua_objlen(L, -2) + 1);
++ }
++
++ lua_pop(L, 1);
++ } else {
++ lua_pushstring(L, value);
++ lua_setfield(L, -2, ".type");
++ }
++
+ lua_pop(L, 1);
+ }
+