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 |
个编辑