Modul:Benutzer:Recompile/MyScript.lua
Erscheinungsbild
Die Dokumentation für dieses Modul kann unter Modul:Benutzer:Recompile/MyScript.lua/Doku erstellt werden
local p = {}
function p.hello(frame)
local name = frame.args[1]
if not name then
name = 'Welt'
end
return 'Hallo, ' .. name .. '! Dies ist Lua!'
end
function p.apples(frame)
return 'Or pears?'
end
function p.chocolate(frame)
return 'And mayonese!'
end
function p.accessPage(frame)
id = mw.wikibase.getEntityIdForTitle( 'Berlin' )
url = mw.wikibase.getEntityUrl(id)
return url
end
function p.accessData(frame)
prop = -1
id = mw.wikibase.getEntityIdForTitle( 'Berlin' )
entity = mw.wikibase.getEntity( id )
props = entity:getProperties()
for k, v in pairs(props) do
if v == 'P17' then
prop = v
end
end
--res = ""
-- len = 0
-- val = nil
property = entity.claims[ 'P571' ] -- P571 represents the inception property .
-- for k, v in pairs(property) do
-- res = res .. ", " .. string.format("%s", v)
-- len = len + 1
-- val = v
-- end
return property[0]
end
return p