Module:Bestiary tables

local p = {}

local pt = require('Module:Paramtest') local hc = pt.has_content local dt = pt.default_to local weaknessmap = mw.loadData('Module:Weakness clickpic/data')

function make_row(info) local ret = '|-\n| ' .. info.name .. '' if info.version then ret = ret .. ' ' .. info.version .. ' '	end local weakness = mw.text.split(string.lower(info.weakness or ''),'%s*,%s*') local wkstr = {} for i,v in ipairs(weakness) do		v = weaknessmap[v] if v then table.insert(wkstr, string.format('',v.image,v.link)) end end weakness = table.concat(wkstr, ' ') ret = ret .. string.format('\n| %s\n| %s\n| %s\n| %s',		info.combat,		info.lifepoints,		info.members,		weakness) return ret end

function p.row(frame) local a = frame.getParent.args local ret = '' if hc(a.version1) then --versioning else ret = make_row({			name = a['%TITLE%'],			combat = a.level,			lifepoints = a.lifepoints,			members = a.members,			weakness = a.weakness			}) end return ret end

return p