Module:Character: Difference between revisions
From The Coffin of Andy and Leyley
(Add Character Module) |
No edit summary |
||
Line 2: | Line 2: | ||
local p = {} | local p = {} | ||
local function v( val, name ) | |||
return not (val ~= nil and type( val ) ~= 'string' and type( val ) ~= 'number') | |||
end | |||
function p.main(frame) | function p.main(frame) | ||
Line 9: | Line 14: | ||
} ) | } ) | ||
retval:addImage( args.image, args.imagecaption ) | |||
if v(args.aliases) then retval:addRow( 'Aliases', args.aliases ) end | |||
if v(args.relatives) then retval:addRow( 'Relatives', args.relatives ) end | |||
if v(args.other) then retval:addRow( 'Other', args.other ) end | |||
if v(args.affilication) then retval:addRow( 'Affiliation', args.affilication ) end | |||
if v(args.occupation) then retval:addRow( 'Occupation', args.occupation ) end | |||
retval:addHeader( 'Biographical information' ) | |||
if v(args.status) then retval:addRow( 'Status', args.status ) end | |||
if v(args.marital) then retval:addRow( 'Marital Status', args.marital ) end | |||
if v(args.age) then retval:addRow( 'Age', args.age ) end | |||
if v(args.birthDate) then retval:addRow( 'Date of birth', args.birthDate ) end | |||
if v(args.birthPlace) then retval:addRow( 'Place of birth', args.birthPlace ) end | |||
if v(args.deathDate) then retval:addRow( 'Date of death', args.deathDate ) end | |||
if v(args.deathPlace) then retval:addRow( 'Place of death', args.deathPlace ) end | |||
retval:addHeader( 'Physical description' ) | |||
if v(args.species) then retval:addRow( 'Species', args.species ) end | |||
if v(args.gender) then retval:addRow( 'Gender', args.gender ) end | |||
if v(args.height) then retval:addRow( 'Height', args.height ) end | |||
if v(args.weight) then retval:addRow( 'Weight', args.weight ) end | |||
if v(args.eyes) then retval:addRow( 'Eye Color', args.eyes ) end | |||
retval:addHeader( 'General Information' ) | |||
if v(args.crimes) then retval:addRow( 'Crime(s)', args.crimes ) end | |||
if v(args.equipment) then retval:addRow( 'Equipment', args.equipment ) end | |||
return retval | return retval | ||
end | end | ||
return p | return p |
Revision as of 03:47, 1 January 2024
Documentation for this module may be created at Module:Character/doc
local capiunto = require 'capiunto'
local p = {}
local function v( val, name )
return not (val ~= nil and type( val ) ~= 'string' and type( val ) ~= 'number')
end
function p.main(frame)
local args = frame:getParent().args
local retval = capiunto.create( {
title = args.name,
} )
retval:addImage( args.image, args.imagecaption )
if v(args.aliases) then retval:addRow( 'Aliases', args.aliases ) end
if v(args.relatives) then retval:addRow( 'Relatives', args.relatives ) end
if v(args.other) then retval:addRow( 'Other', args.other ) end
if v(args.affilication) then retval:addRow( 'Affiliation', args.affilication ) end
if v(args.occupation) then retval:addRow( 'Occupation', args.occupation ) end
retval:addHeader( 'Biographical information' )
if v(args.status) then retval:addRow( 'Status', args.status ) end
if v(args.marital) then retval:addRow( 'Marital Status', args.marital ) end
if v(args.age) then retval:addRow( 'Age', args.age ) end
if v(args.birthDate) then retval:addRow( 'Date of birth', args.birthDate ) end
if v(args.birthPlace) then retval:addRow( 'Place of birth', args.birthPlace ) end
if v(args.deathDate) then retval:addRow( 'Date of death', args.deathDate ) end
if v(args.deathPlace) then retval:addRow( 'Place of death', args.deathPlace ) end
retval:addHeader( 'Physical description' )
if v(args.species) then retval:addRow( 'Species', args.species ) end
if v(args.gender) then retval:addRow( 'Gender', args.gender ) end
if v(args.height) then retval:addRow( 'Height', args.height ) end
if v(args.weight) then retval:addRow( 'Weight', args.weight ) end
if v(args.eyes) then retval:addRow( 'Eye Color', args.eyes ) end
retval:addHeader( 'General Information' )
if v(args.crimes) then retval:addRow( 'Crime(s)', args.crimes ) end
if v(args.equipment) then retval:addRow( 'Equipment', args.equipment ) end
return retval
end
return p