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

мНет описания правки
мНет описания правки
Строка 40: Строка 40:
local function format_value(v)
local function format_value(v)
     if v == nil then return "" end
     if v == nil then return "" end
    if type(v) == "table" and next(v) == nil then
        return ""
    end
     local t = type(v)
     local t = type(v)
     if t == "string" or t == "number" or t == "boolean" then
     if t == "string" or t == "number" or t == "boolean" then
Строка 224: Строка 221:
             local key = (prefix == "" and tostring(k) or prefix .. "." .. tostring(k))
             local key = (prefix == "" and tostring(k) or prefix .. "." .. tostring(k))
             if type(v) == "table" then
             if type(v) == "table" then
                 if is_array(v) then
                 if next(v) == nil then
                elseif is_array(v) then
                     local ok, json = pcall(mw.text.jsonEncode, v)
                     local ok, json = pcall(mw.text.jsonEncode, v)
                     if ok and json then
                     if ok and json then