Module:Sandbox/Xinbenlv/WikiTextFromWikibase

< Module:Sandbox
Revision as of 23:46, 26 March 2019 by imported>Xinbenlv (// Edit via Wikiplus)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Lua error at line 9: attempt to index global 'entity' (a nil value).


---------- Module:WikiLoop ----------------
local p = {}

function p.getStub()
    mw.log("hello")
    qid = "Q13406268"
    lang = 'zh'
    entity = mw.wikibase.getEntity(qid)
    return entity:getDescription(lang)
end

function p.renderSnak()
    local entity = mw.wikibase.getEntity()
    local snak = entity['claims']['P342'][1]['qualifiers']['P342'][1]

    return mw.wikibase.renderSnak( snak ) -- Returns the given Snak value formatted as wikitext escaped plain text.
end


return p