„Modul:Benutzer:Recompile/MyScript.lua“ – Versionsunterschied
Erscheinungsbild
[gesichtete Version] | [gesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 36: | Zeile 36: | ||
--res = "" |
--res = "" |
||
len = 0 |
len = 0 |
||
val = nil |
|||
property = entity.claims[ 'P571' ] -- P571 represents the inception property . |
property = entity.claims[ 'P571' ] -- P571 represents the inception property . |
||
for k, v in pairs(property) do |
for k, v in pairs(property) do |
||
-- res = res .. ", " .. string.format("%s", v) |
-- res = res .. ", " .. string.format("%s", v) |
||
len = len + 1 |
len = len + 1 |
||
val = v |
|||
end |
end |
||
return |
return val |
||
end |
end |
||
Version vom 4. März 2018, 13:21 Uhr
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 val
end
return p