На случай неупорядоченных нумерических индексов

This commit is contained in:
igor 2018-01-10 18:58:11 +03:00
parent 4e81812f4a
commit 006bed7825
2 changed files with 5 additions and 8 deletions

View File

@ -253,7 +253,7 @@
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/advancedLua.lua",
type="Library",
preloadFile=true,
version=1.34,
version=1.35,
},
{
path="/lib/web.lua",

View File

@ -285,13 +285,10 @@ function table.serialize(array, prettyLook, indentationWidth, indentUsingTabs, r
end
if keyType == "number" then
if not prettyLook then
table.insert(result, "[")
table.insert(result, key)
table.insert(result, "]")
table.insert(result, equalsSymbol)
end
table.insert(result, "[")
table.insert(result, key)
table.insert(result, "]")
table.insert(result, equalsSymbol)
elseif keyType == "string" then
-- Короч, если типа начинается с буковки, а также если это алфавитно-нумерическая поеботня
if prettyLook and key:match("^%a") and key:match("^[%w%_]+$") then