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