Modul:Testmodul: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
K (HeikoTest verschob die Seite Modul:Testmodul2 nach Modul:Testmodul, ohne dabei eine Weiterleitung anzulegen)
 
(6 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 9: Zeile 9:


function p.geocode(frame)
function p.geocode(frame)
    local place = frame.args[1] or "Berlin"  -- Standardwert "Berlin", falls keine Eingabe
local place = frame.args[1] or "Berlin"  -- Standardwert: Berlin, wenn kein Ort angegeben
     local result = mw.ext.geodata.geocode(place)
     x= frame:preprocess('{{#geocode:' .. place .. '}}')
      
      
     if result then
     -- Rückgabe der Geokoordinaten
        local lat = result.lat
    return "Geocode von " .. place .. ": " .. x
        local lon = result.lon
        return "Die Koordinaten von " .. place .. " sind: " .. lat .. ", " .. lon
    else
        return "Ort nicht gefunden"
    end
end
end
mw.log()


return p
return p

Aktuelle Version vom 27. Oktober 2025, 08:12 Uhr

Die Dokumentation für dieses Modul kann unter Modul:Testmodul/Doku erstellt werden

local p = {} --p stands for package

function p.attribute( frame )
	a = frame.args[1] or ""
	name = frame.args.name or ""
	t = 'Funktion attribute "name":'.. name.. ', unbenanntes Attribut 1:'..a
	return t
end

function p.geocode(frame)
	local place = frame.args[1] or "Berlin"  -- Standardwert: Berlin, wenn kein Ort angegeben
    x= frame:preprocess('{{#geocode:' .. place .. '}}')
    
    -- Rückgabe der Geokoordinaten
    return "Geocode von " .. place .. ": " .. x
end

mw.log()

return p