Module:Character age

local p = {}

function p.characterAge(frame) local age = frame.args[1] or frame.args.age local work_input = frame.args[2] or frame.args.work local year_input = frame.args[3] or frame.args.year if string.find(work_input, 'PD') then work, punc, year = work_input, ,  end if string.find(work_input, '1') or string.find(work_input, 'one') then if string.find(work_input, 'start') or string.find(work_input, 'beginning') then work, punc, year = 'start of Campaign 1', '; ', '810 PD' else if string.find(work_input, 'end') then work, punc, year = 'end of Campaign 1', '; ', '812 PD' else work, punc, year = 'Campaign 1', '; ', '810–812 PD' end end if string.find(work_input, '2') or string.find(work_input, 'two') then if string.find(work_input, 'start') or string.find(work_input, 'beginning') then work, punc, year = 'start of Campaign 2', '; ', '835 PD' else if string.find(work_input, 'end') then work, punc, year = 'end of Campaign 2', '; ', '836 PD' else work, punc, year = 'Campaign 2', '; ', '835–836 PD' end end end

if string.find(work_input, '2') or string.find(work_input, 'two') then work, punc, year = 'Campaign 3', '; ', '843 PD' end else if year_input == nil then work, year = work_input, '' else work, punc, year = work_input, '; ', year_input end end return age .. ' (' .. work .. punc .. year .. ')' end

return p