Module:GetJSON: Difference between revisions

From AlternateWiki
595 bytes added ,  1 month ago
no edit summary
No edit summary
No edit summary
Line 31:
return value
end
-- Function to check if a table is an array
local function isArray(table)
local count = 0
for k, _ in pairs(table) do
if type(k) ~= "number" then
return false
end
count = count + 1
end
return #table == count
end
 
Line 38 ⟶ 50:
if value ~= nil then
if type(value) == "table" then
localif strisArray(value) = ""then
for k, v in pairs(value)local dostr = ""
strfor =_, strv .. vin ..ipairs(value) ";"do
str = str .. v .. ";"
end
return frame:preprocess(str:sub(1, -2))
else
local str = ""
for k, _ in pairs(value) do
str = str .. k .. ";"
end
return frame:preprocess(str:sub(1, -2))
end
return frame:preprocess(str:sub(1, -2))
end
return frame:preprocess(value)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.