Sacra.Wiki Modul:RandomPerson

Modul:RandomPerson

Aus Sacra.Wiki

Die Dokumentation für dieses Modul kann unter Modul:RandomPerson/Doku erstellt werden

local p = {}

function p.ask()
	if not mw.smw then
        return "mw.smw module not found"
	end

	local queryResult = mw.smw.ask("[[Kategorie:Person]]|?Name|?Bildname|limit=3|order=random")
	
	if queryResult == nil then
        return "(no values)"
	end
	return mw.dumpObject(queryResult)
	--[[
	if type( queryResult ) == "table" then
        local myResult = ""
        for num, row in pairs( queryResult ) do
            myResult = myResult .. '* This is result #' .. num .. '\n'
            for property, data in pairs( row ) do
                local dataOutput = data
                if type( data ) == 'table' then
                    dataOutput = mw.text.listToText( data, ', ', ' and ')
                end
                myResult = myResult .. '** ' .. property .. ': ' .. dataOutput .. '\n'
            end
        end
        return myResult
    end
    ]]--
end

return p
Cookies helfen uns bei der Bereitstellung von Sacra.Wiki. Durch die Nutzung von Sacra.Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.