From 3efef0fad233598784af91407f7acda08026265b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 24 Apr 2018 17:35:06 +0100 Subject: [Fix] Propagate key when import implicit array from Lua --- contrib/libucl/lua_ucl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/libucl/lua_ucl.c b/contrib/libucl/lua_ucl.c index 15d41471e..e1a784753 100644 --- a/contrib/libucl/lua_ucl.c +++ b/contrib/libucl/lua_ucl.c @@ -297,7 +297,7 @@ ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array) static ucl_object_t * ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) { - ucl_object_t *obj, *top = NULL; + ucl_object_t *obj, *top = NULL, *cur; size_t keylen; const char *k; bool is_array = true, is_implicit = false, found_mt = false; @@ -407,6 +407,13 @@ ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) if (obj != NULL) { ucl_object_insert_key (top, obj, k, keylen, true); + + DL_FOREACH (obj, cur) { + if (cur->keylen == 0) { + cur->keylen = keylen; + cur->key = k; + } + } } lua_pop (L, 2); } -- cgit v1.2.3