Module:Characters: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 31: Line 31:


function p.profile(frame)
function p.profile(frame)
local pageName = frame.args[1]
local charName = frame.args[1]
if not pageName then pageName=frame:getParent():getTitle() end
if not charName then return end
local query = {
local query = {
limit = '1',
limit = '1',
where = 'name_en="' .. pageName .. '"',
where = 'name_en="' .. charName .. '"',
}
}
local fields = {'strengths','weaknesses','ears','tail','family',
local fields = {'strengths','weaknesses','ears','tail','family',
Line 44: Line 44:


local ch = characters[1]
local ch = characters[1]
if ch then
if not ch then return end
local template = frame:expandTemplate{
local template = frame:expandTemplate{
title='Character Profile/table',
title='Character Profile/table',
args={
args={
strengths=ch.strengths,
strengths=ch.strengths,
weaknesses=ch.weaknesses,
weaknesses=ch.weaknesses,
ears=ch.ears,
ears=ch.ears,
tail=ch.tail,
tail=ch.tail,
family=ch.family,
family=ch.family,
my_rule=ch.my_rule,
my_rule=ch.my_rule,
phone_background=ch.phone_background,
phone_background=ch.phone_background,
before_a_race=ch.before_a_race,
before_a_race=ch.before_a_race,
good_subject=ch.good_subject,
good_subject=ch.good_subject,
secret_pride=ch.secret_pride,
secret_pride=ch.secret_pride,
frequent_purchase=ch.frequent_purchase,
frequent_purchase=ch.frequent_purchase,
secret1=ch.secret1,
secret1=ch.secret1,
secret2=ch.secret2,
secret2=ch.secret2,
}
}
}
return template
}
end
return template
return frame.args[1]
end
end


return p
return p