Модуль:GetField: различия между версиями

Нет описания правки
Нет описания правки
Строка 1135: Строка 1135:


for _, k in ipairs(keys) do
for _, k in ipairs(keys) do
local v = value[k]
if not (options.nestedKeyMode == "raw" and type(k) == "number") then
local key
local v = value[k]
if prefix and options.nestedKeyMode == "prefixed" then
local key
key = prefix .. "." .. tostring(k)
if prefix and options.nestedKeyMode == "prefixed" then
else
key = prefix .. "." .. tostring(k)
key = tostring(k)
else
end
key = tostring(k)
end


if type(v) == "table" then
if type(v) == "table" then
if is_array_of_primitives(v) then
if is_array_of_primitives(v) then
local json = encode_nowiki_json(v)
local json = encode_nowiki_json(v)
if json then
if json then
parts[#parts + 1] = key .. "=" .. tostring(json)
parts[#parts + 1] = key .. "=" .. tostring(json)
end
elseif options.nestedKeyMode == "raw" then
local json = encode_nowiki_json(v)
if json then
parts[#parts + 1] = key .. "=" .. tostring(json)
end
end
end
elseif options.nestedKeyMode == "raw" then
 
local json = encode_nowiki_json(v)
if next(v) ~= nil then
if json then
local childPrefix = (options.nestedKeyMode == "prefixed") and key or nil
parts[#parts + 1] = key .. "=" .. tostring(json)
append_table_fields(parts, v, options, childPrefix)
end
end
else
parts[#parts + 1] = key .. "=" .. tostring(v)
end
end
if next(v) ~= nil then
local childPrefix = (options.nestedKeyMode == "prefixed") and key or nil
append_table_fields(parts, v, options, childPrefix)
end
else
parts[#parts + 1] = key .. "=" .. tostring(v)
end
end
end
end