Module:Sandbox/Dianliang233/Version API
Jump to navigation
Jump to search
local p = {}
function p.getFormattedItem( itemName )
local frame = mw.getCurrentFrame()
local res = frame:expandTemplate{ title = 'fpv', args = { itemName, nolink = '1' } }
if res ~= '' then
return '"' .. itemName .. '": "' .. res .. '"'
else
return '"' .. itemName .. '": null'
end
end
local versions = {
"java", "java-experimental-version", "java-upcoming", "java-experimental", "java-snap", "java-combat-snap",
"bedrock-mobile", "bedrock-switch", "bedrock-fire", "bedrock-ios", "bedrock-ps4", "bedrock-win", "bedrock-android",
"bedrock-xbone", "bedrock", "bedrock-realm-server", "bedrock-upcoming", "bedrock-upcoming2", "bedrock-beta-android",
"bedrock-beta", "bedrock-preview-win", "bedrock-preview-ios", "bedrock-preview-xbone", "bedrock-preview",
"editor-bedrock-beta", "bds-preview", "dungeons-launcher", "dungeons-msstore", "dungeons-win", "dungeons-steam",
"dungeons-xbone", "dungeons-xbseries", "dungeons-xbox","dungeons-switch", "dungeons-ps4", "dungeons",
"dungeons-internal", "legends", "legends-ps", "legends-steam", "legends-xbox", "legends-win", "legends-switch",
"launcher-win", "launcher-mac", "launcher-lin", "launcher-win-msstore", "launcher", "launcher-beta-win",
"launcher-beta-mac", "launcher-beta-lin", "launcher-beta-win-msstore", "launcher-beta", "education-win",
"education-android", "education-ios", "education-mac", "education", "education-beta-android", "education-beta-chromeos",
"education-beta", "education-upcoming", "classroom_mode", "code_connection", "china-win", "china-mobile"
}
function p.main()
local items = {}
for _, i in pairs(versions) do
table.insert(items, p.getFormattedItem(i))
end
return '{' .. table.concat(items, ',') .. '}'
end
return p