Модуль:GetField: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 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 v = value[k] | |||
local key | |||
if prefix and options.nestedKeyMode == "prefixed" then | |||
key = prefix .. "." .. tostring(k) | |||
else | |||
key = tostring(k) | |||
end | |||
if type(v) == "table" then | |||
if is_array_of_primitives(v) then | |||
local json = encode_nowiki_json(v) | local json = encode_nowiki_json(v) | ||
if json then | |||
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 | ||
if next(v) ~= nil then | |||
local childPrefix = (options.nestedKeyMode == "prefixed") and key or nil | |||
append_table_fields(parts, v, options, childPrefix) | |||
end | end | ||
else | |||
parts[#parts + 1] = key .. "=" .. tostring(v) | |||
end | end | ||
end | end | ||
end | end | ||