RequestHelper
来自蒙纳多研究本部
此模块的文档可以在模块:RequestHelper/doc创建
local p = {} p.language = "cn" local cache = {} function p.post(tablename, row_id, language) if language == nil then language = p.language end local cacheKey = tablename .. ":" .. (row_id or "") .. ":" .. language if cache[cacheKey] == nil then cache[cacheKey] = mw.xbdb.getBdatData( { game = "xb1", table = tablename, row_id = row_id, language = language } ) end return cache[cacheKey] end function p.output(frame) local tablename = mw.text.trim(frame.args[1]) local row_id = frame.args[2] and mw.text.trim(frame.args[2]) or nil return mw.text.jsonEncode(p.post(tablename, row_id)) end return p