Module:Sandbox/Gnosygnu
Appearance
--This Module is for various Lua experimentation.
--It is not meant to be used by other pages, and can be safely deleted.
local p = {}
function p.string_compare_gt(frame)
return frame.args[1] > frame.args[2]
end
function p.string_compare_lte(frame)
return frame.args[1] <= frame.args[2]
end
function p.string_compare_example(frame)
return ('АД' > 'Аг') and ('АД' <= 'Аж')
end
function p.test()
local entity = mw.wikibase.sitelink('Q2')
return entity
end
function p.wikibase_test(frame)
local entity = mw.wikibase.getEntityObject()
if not entity then
return 'no entity'
end
local claims = entity.claims
if not claims then
return 'no claims'
end
local prop = claims[frame.args[1]]
if not prop then
return 'missing:'..frame.args[1]
end
local rv = ''
local val = prop[0]
if not val then
rv = rv .. '0:nil;'
else
rv = rv .. '0:val;'
end
val = prop[1]
if not val then
rv = rv .. '1:nil;'
else
rv = rv .. '1:val;'
end
return rv
end
return p