Modul:AlteSäcke: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 3: | Zeile 3: | ||
function robusttrim(s) | function robusttrim(s) | ||
if s==nil then return '' end | if s==nil then return '' end | ||
local p= | local p=mw.ustring.gsub(s,'%[%[SMW::on%]%]','') | ||
p= | p=mw.ustring.gsub(p,'%[%[SMW::off%]%]','') | ||
return mw.text.trim(p) | return mw.text.trim(p) | ||
end | end | ||
function p.Auswertung() | function p.Auswertung() | ||
local frame=mw.getCurrentFrame() | |||
local person=robusttrim(frame.args[1]) | |||
return " | local alter=tonumber(robusttrim(frame.args[2])) | ||
local kategorie=robusttrim(frame.args[3]) | |||
local kannsterben=robusttrim(frame.args[4]) | |||
local lebend=robusttrim(frame.args[5]) | |||
local grafschaft="Sonstige" | |||
if(mw.ustring.find(kategorie,"Markgrafschaft Perricum")~=nil) then grafschaft="Perricum" end | |||
if(mw.ustring.find(kategorie,"Markgrafschaft Greifenfurt")~=nil) then grafschaft="Greifenfurt" end | |||
if(mw.ustring.find(kategorie,"Kaisermark Gareth")~=nil) then grafschaft="Kaisermark" end | |||
if(mw.ustring.find(kategorie,"Grafschaft Hartsteen")~=nil) then grafschaft="Hartsteen" end | |||
if(mw.ustring.find(kategorie,"Grafschaft Waldstein")~=nil) then grafschaft="Waldstein" end | |||
if(mw.ustring.find(kategorie,"Grafschaft Reichsforst")~=nil) then grafschaft="Reichsforst" end | |||
if(mw.ustring.find(kategorie,"Grafschaft Eslamsgrund")~=nil) then grafschaft="Eslamsgrund" end | |||
if(mw.ustring.find(kategorie,"Grafschaft Schlund")~=nil) then grafschaft="Schlund" end | |||
local stirbtbei="" | |||
if(alter>=50)and(alter<=55) then stirbtbei="nur 20" end | |||
if(alter>=56)and(alter<=65) then stirbtbei="19 bis 20" end | |||
if(alter>=66)and(alter<=75) then stirbtbei="17 bis 20" end | |||
if(alter>=76)and(alter<=85) then stirbtbei="10 bis 20" end | |||
if(alter>=86) then stirbtbei="6 bis 20" end | |||
return " "..person..","..grafschaft..","..alter..","..stirbtbei..","..kannsterben..","..lebend.."\n" | |||
end | end | ||
return p | return p |
Aktuelle Version vom 17. Mai 2021, 14:39 Uhr
Die Dokumentation für dieses Modul kann unter Modul:AlteSäcke/Doku erstellt werden
local p = {} function robusttrim(s) if s==nil then return '' end local p=mw.ustring.gsub(s,'%[%[SMW::on%]%]','') p=mw.ustring.gsub(p,'%[%[SMW::off%]%]','') return mw.text.trim(p) end function p.Auswertung() local frame=mw.getCurrentFrame() local person=robusttrim(frame.args[1]) local alter=tonumber(robusttrim(frame.args[2])) local kategorie=robusttrim(frame.args[3]) local kannsterben=robusttrim(frame.args[4]) local lebend=robusttrim(frame.args[5]) local grafschaft="Sonstige" if(mw.ustring.find(kategorie,"Markgrafschaft Perricum")~=nil) then grafschaft="Perricum" end if(mw.ustring.find(kategorie,"Markgrafschaft Greifenfurt")~=nil) then grafschaft="Greifenfurt" end if(mw.ustring.find(kategorie,"Kaisermark Gareth")~=nil) then grafschaft="Kaisermark" end if(mw.ustring.find(kategorie,"Grafschaft Hartsteen")~=nil) then grafschaft="Hartsteen" end if(mw.ustring.find(kategorie,"Grafschaft Waldstein")~=nil) then grafschaft="Waldstein" end if(mw.ustring.find(kategorie,"Grafschaft Reichsforst")~=nil) then grafschaft="Reichsforst" end if(mw.ustring.find(kategorie,"Grafschaft Eslamsgrund")~=nil) then grafschaft="Eslamsgrund" end if(mw.ustring.find(kategorie,"Grafschaft Schlund")~=nil) then grafschaft="Schlund" end local stirbtbei="" if(alter>=50)and(alter<=55) then stirbtbei="nur 20" end if(alter>=56)and(alter<=65) then stirbtbei="19 bis 20" end if(alter>=66)and(alter<=75) then stirbtbei="17 bis 20" end if(alter>=76)and(alter<=85) then stirbtbei="10 bis 20" end if(alter>=86) then stirbtbei="6 bis 20" end return " "..person..","..grafschaft..","..alter..","..stirbtbei..","..kannsterben..","..lebend.."\n" end return p