„Modul:Benutzer:Reinhard Kraasch/MyScript.lua“ – Versionsunterschied
Erscheinungsbild
[gesichtete Version] | [gesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
KKeine Bearbeitungszusammenfassung |
KKeine Bearbeitungszusammenfassung |
||
Zeile 19: | Zeile 19: | ||
prop = -1 |
prop = -1 |
||
local arg = frame.args[1] |
local arg = frame.args[1] |
||
if not |
if not arg then |
||
arg = 'Berlin' |
arg = 'Berlin' |
||
end |
end |
||
Zeile 33: | Zeile 33: | ||
function p.getFinchLabel(frame) |
function p.getFinchLabel(frame) |
||
id = 'Q167' |
|||
entity = mw.wikibase.getEntity( id ) |
|||
finchLabel = mw.wikibase.getLabel( |
finchLabel = mw.wikibase.getLabel(entity) |
||
return finchLabel |
return finchLabel |
||
end |
end |
Version vom 10. April 2018, 10:11 Uhr
Die Dokumentation für dieses Modul kann unter Modul:Benutzer:Reinhard Kraasch/MyScript.lua/Doku erstellt werden
local p = {}
--local wd = require('Module:Wikidata')
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.accessPage(frame)
id = mw.wikibase.getEntityIdForTitle( 'Berlin' )
url = mw.wikibase.getEntityUrl(id)
return url
end
function p.accessData(frame)
prop = -1
local arg = frame.args[1]
if not arg then
arg = 'Berlin'
end
s = ""
id = mw.wikibase.getEntityIdForTitle( arg )
entity = mw.wikibase.getEntity( id )
props = entity:getProperties()
for k, v in pairs(props) do
s = s .. k .. ": " .. v .. "\n"
end
return "<pre>" .. s .. "</pre>"
end
function p.getFinchLabel(frame)
id = 'Q167'
entity = mw.wikibase.getEntity( id )
finchLabel = mw.wikibase.getLabel(entity)
return finchLabel
end
return p