Module:GetJSON: Difference between revisions
From AlternateWiki
Content added Content deleted
No edit summary |
No edit summary |
||
Line 1:
local p = {}
p.main = function(
-- Function to split the key by "."
-- Function to get the value from the nested table
end
return value▼
-- If the value is a table and contains json_file and json_key
local keys = splitKey(frame.args[2])▼
if type(value) == "table" and value.json_file and value.json_key then
local value = getValueByKeys(m.root, keys)▼
local newRoot = mw.loadJsonData(value.json_file)
local newKeys = splitKey(value.json_key)
if value ~= nil then▼
return getValueByKeys(newRoot, newKeys)
if type(value) == "table" then▼
end
local str = ""▼
for k,v in pairs(value) do▼
str = str .. v .. ";"▼
return frame:preprocess(str:sub(1, -2))▼
return frame:preprocess(value)▼
end
end
else
end
end
|