Please remember that WiKirby contains spoilers, which you read at your own risk! See our general disclaimer for details.

Module:DYK

From WiKirby, your independent source of Kirby knowledge.
Revision as of 19:35, 7 June 2022 by Lakelimbo (talk | contribs) (Remake of {{DYK}})
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A version of {{DYK}} that doesn't use #var. Pulls the facts from Module:DYK/facts. Use by typing {{#invoke:DYK|random}}.


local d = {}
local lang = mw.language.getContentLanguage()
local result = {}

function d.random ()
	local z = require('Module:DYK/facts')
	
	local p1 = math.random( lang:formatDate("n") , #z )
	local p2 = math.random( lang:formatDate("W") , #z )
	local p3 = math.random( lang:formatDate("z") , #z )
	
	local y1 = z[p1]
	local y2 = z[p2]
	local y3 = z[p3]
	
	table.insert(result, '<ul><li>'.. y1 ..'</li><li>'.. y2 ..'</li><li>'.. y3 ..'</li></ul>')
	return table.concat(result, '')
end

return d