Jump to content

Module:User:Yair rand/sandbox

From Wikipedia, the free encyclopedia
return { main = function()
	local x = mw.wikibase.getEntity().claims.p1082
	local i = 0
	local a, b
	local result = "{|class=\"wikitable sortable\"\n|-\n!Language!!Number of native speakers\n"
	while x[ i ] do
		a = x[ i ]
		b = a.qualifiers.p103
		if b then
			result = result ..
				"|-\n|[[" ..
				mw.wikibase.sitelink( "Q" .. b[ 0 ].datavalue.value['numeric-id'] ) ..
				"|" ..
				mw.wikibase.label( "Q" .. b[ 0 ].datavalue.value['numeric-id'] ) .. 
				"]]\n|" .. 
				a.mainsnak.datavalue.value.amount:sub(2) ..
				"\n"
		end
		i = i + 1
	end
	
	return result .. "|}"
end}