2,032
次編輯
(创建页面,内容为“local checkType = require 'libraryUtil'.checkType local p = {} local srcFileName = { ['songs'] = {'Songlist.json', 'Songlist NS.json'}, ['packs'] = {'Packlist.json', 'Packlist NS'}, ['unlocks'] = {'Unlocks.json', 'Unlocks NS'}, } function p.listOf(type, platform) return mw.text.jsonDecode(mw.title.new(srcFileName[type][platform == 'ns' and 2 or 1], 'Template'):getContent())[type] end local commonExpr = { title = '.title_localized.en', pstChartDesigner =…”) |
小 (允许platform与target的nil) |
||
行 70: | 行 70: | ||
checkType('songQuery', 2, prop, 'string') | checkType('songQuery', 2, prop, 'string') | ||
local obj = getmetatable(t)._info_ | local obj = getmetatable(t)._info_ | ||
if | if not obj then return nil end | ||
local expr = commonExpr[prop] | local expr = commonExpr[prop] | ||
if expr then return chain(obj, expr) end | if expr then return chain(obj, expr) end | ||
行 79: | 行 79: | ||
end | end | ||
function p.songQueryWrap(song) | function p.songQueryWrap(song) | ||
checkType('songQueryWrap', 1, song, 'table') | checkType('songQueryWrap', 1, song, 'table', true) | ||
return setmetatable({}, {__call = songQuery, __index = songQuery, _info_ = song}) | return setmetatable({}, {__call = songQuery, __index = songQuery, _info_ = song}) | ||
end | end | ||
行 114: | 行 114: | ||
end | end | ||
function p.packQueryWrap(id, platform) | function p.packQueryWrap(id, platform) | ||
platform = platform or 'mobile' | |||
local packData = mPlatFormPackData[platform] | local packData = mPlatFormPackData[platform] | ||
if not packData then | if not packData then | ||
行 119: | 行 120: | ||
mPlatFormPackData[platform] = packData | mPlatFormPackData[platform] = packData | ||
end | end | ||
-- return id and packData[id] or packData | |||
return packData[id] or {name = '请更新plst', section = 'unknown'} | return packData[id] or {name = '请更新plst', section = 'unknown'} | ||
end | end | ||
return p | return p |
次編輯