15.101
Bearbeitungen
(Variablen Schreibweise) |
K (Entfernte den Schutz von „Modul:Geo“) |
||
| (2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 85: | Zeile 85: | ||
function p.GetPLZList(frame) | function p.GetPLZList(frame) | ||
return table.concat(p.getPLZList(), frame.args.sep or ";") | |||
end | end | ||
| Zeile 98: | Zeile 95: | ||
-- mw.logObject(frame) | -- mw.logObject(frame) | ||
local plz = "" | local plz = "" | ||
local stadtteile = frame.args[1] | local stadtteile = frame.args[1] or "" | ||
if | if stadtteile ~= "" then | ||
local stadtteile = str.splitAndStrip(stadtteile, ";") | local stadtteile = str.splitAndStrip(stadtteile, ";") | ||
plz = p.stadtteil2PLZ(stadtteile) | plz = p.stadtteil2PLZ(stadtteile) | ||
plz = | plz = table.concat(plz, ";") | ||
end | end | ||
-- mw.log(plz) | -- mw.log(plz) | ||
| Zeile 111: | Zeile 108: | ||
-- gibt die Postleitzahlen der Stadtteile als table zurück | -- gibt die Postleitzahlen der Stadtteile als table zurück | ||
local plz_table = {} | local plz_table = {} | ||
if type(stadtteile) == "table" then | |||
for _, s in pairs(stadtteile) do | |||
for _, p in pairs(que.getValues(s, "PLZ", true)) do -- p ist string | |||
plz_table[tonumber(p)] = true -- diese Mechanik verhindert mehrfaches Einfügen der gleichen PLZ | |||
end | end | ||
end | end | ||
elseif stadtteile ~= nil and stadtteile ~= "" then | |||
plz_table[tonumber(que.getValues(stadtteile, "PLZ", true)[1])] = true | |||
end | end | ||
-- mw.logObject(plz_table) | -- mw.logObject(plz_table) | ||