Module:FGOCards
跳到导航
跳到搜索
- -- Originally designed and coded by Maya (U:MJH)
- local getArgs = require("Module:Arguments").getArgs
- local cardMap = {
- Q = 'Quick',
- A = 'Arts',
- B = 'Buster'
- }
- local stringToTable = function (str)
- local rettbl = {}
- mw.ustring.gsub(str, '.',
- function (c)
- table.insert(rettbl, c)
- end)
- return rettbl
- end
- local tableToCards = function (tbl, size)
- local retstr = ''
- for i = 1, #tbl do
- retstr = retstr .. [=[[[File:]=] ..
- (cardMap[tbl[i]] or tbl[i]) .. '.png|' ..
- (size or 40) .. [=[px|link=]]]=]
- end
- return retstr
- end
- local FGOCards = {
- main = function (frame)
- local args = getArgs(frame)
- return tableToCards(stringToTable(args[1]), args[2])
- end,
- stringToCards = function (str, size)
- return tableToCards(stringToTable(str), size)
- end,
- tableToCards = tableToCards
- }
- return FGOCards