Module:GetCreatureStats: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local p = {} local cargo = mw.ext.cargo function p.main(frame) --[ If creature is specified, cargo query any unfilled stats] local creature = frame.args.creature or ''...") |
(No difference)
|
Revision as of 16:19, 24 September 2019
Documentation for this module may be created at Module:GetCreatureStats/doc
local p = {}
local cargo = mw.ext.cargo
function p.main(frame)
--[ If creature is specified, cargo query any unfilled stats]
local creature = frame.args.creature or ''
local resulttable = {}
if creature ~= '' then
local result = cargo.query('Characters', '_pageName=Page, Title, Level, HP, AV, DV, MA, Strength, Agility, Toughness, Agility, Willpower, Ego', {where = '_pageNamespace="0" AND _pageName="' .. creature .. '"'})
if not next(result) then
error ("There was no creature named " .. creature .. "!")
end
resulttable = result[1]
end
dispname = resulttable['Title'] or ''
hp = (frame.args.hp ~= '' and frame.args.hp or resulttable['HP']) or '0'
frame:expandTemplate{title = 'CharaSim', args = {['title'] = dispname, ['hp'] = hp}}
end
return p