Module:DidYouKnow: Difference between revisions
no edit summary
Admin Jeremy (talk | contribs) (Created page with "local p = {} -- CONFIG local DATA_PAGE = "Template:Did you know/Data" function p.main(frame) local title = mw.title.new(DATA_PAGE) if not title or not title.exists then return "<span class='error'>DidYouKnow: data page not found</span>" end local content = title:getContent() if not content then return "<span class='error'>DidYouKnow: no content</span>" end local items = {} -- Parse bullet list for line in content:g...") |
Admin Jeremy (talk | contribs) No edit summary |
||
| Line 29: | Line 29: | ||
end | end | ||
-- | -- Safe random seed | ||
math.randomseed(os.time() | math.randomseed(os.time()) | ||
math.random() -- throw away first value | |||
local choice = items[math.random(#items)] | local choice = items[math.random(#items)] | ||
return choice | return choice | ||
end | end | ||
return p | return p | ||