<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ACarousel%2Fsandbox</id>
	<title>Module:Carousel/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ACarousel%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Carousel/sandbox&amp;action=history"/>
	<updated>2026-05-08T03:51:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Carousel/sandbox&amp;diff=135481&amp;oldid=prev</id>
		<title>imported&gt;RexxS: update to use mw.loadData</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Carousel/sandbox&amp;diff=135481&amp;oldid=prev"/>
		<updated>2019-05-28T02:14:19Z</updated>

		<summary type="html">&lt;p&gt;update to use mw.loadData&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
p = {}&lt;br /&gt;
&lt;br /&gt;
-- carousel returns one of a list of image filenames&lt;br /&gt;
--&lt;br /&gt;
-- the index of the one chosen increments every &amp;#039;switchsecs&amp;#039;&lt;br /&gt;
-- which is a parameter giving the number of seconds between switches&lt;br /&gt;
-- 3600 would switch every hour&lt;br /&gt;
-- 43200 would be every 12 hours&lt;br /&gt;
-- 86400 would be daily (the default)&lt;br /&gt;
--&lt;br /&gt;
-- The list of filenames is in a named submodule, so everyone can have their own list.&lt;br /&gt;
-- For Bishonen (the default), the module is [[Module:Carousel/Shonen]].&lt;br /&gt;
-- For Serial Number 54129, the module is [[Module:Carousel/54129]].&lt;br /&gt;
--&lt;br /&gt;
-- {{#invoke:carousel | main | name = name-of-datamodule | switchsecs = number-of-seconds }}&lt;br /&gt;
-- {{#invoke:carousel | main | name = 54129 | switchsecs = 10 }} for 10 sec switches using [[Module:Carousel/54129]]&lt;br /&gt;
-- {{#invoke:carousel | main }} for 24 hours between switches using the default data module&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
p.main = function(frame)&lt;br /&gt;
	-- get parameter switchsecs; if NaN or less than 1, set default&lt;br /&gt;
	local switchtime = tonumber(frame.args.switchsecs) or 86400&lt;br /&gt;
	if switchtime &amp;lt; 1 then switchtime = 86400 end&lt;br /&gt;
&lt;br /&gt;
	-- get parameter dataname; if missing, use default&lt;br /&gt;
	local dataname = frame.args.name or &amp;quot;&amp;quot;&lt;br /&gt;
	if dataname == &amp;quot;&amp;quot; then dataname = &amp;quot;Shonen&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
	-- there should be a named data module as a submodule&lt;br /&gt;
	-- it returns a sequential table of filenames&lt;br /&gt;
	local imgs = mw.loadData(&amp;quot;Module:Carousel/&amp;quot; .. dataname)&lt;br /&gt;
	local numimgs = #imgs&lt;br /&gt;
&lt;br /&gt;
	-- &amp;#039;now&amp;#039; increments by 1 every switchtime seconds&lt;br /&gt;
	local now = math.floor( os.time() / switchtime )&lt;br /&gt;
&lt;br /&gt;
	-- set an index between 1 and number of images&lt;br /&gt;
	local idx = now % numimgs + 1&lt;br /&gt;
	return imgs[idx]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;RexxS</name></author>
	</entry>
</feed>