Module:DYK empty prep slots

From PRD Wiki
Revision as of 05:00, 3 February 2026 by wp>Theleekycauldron (+)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:DYK empty prep slots/doc

local p = {};

p.num_empty = function(prep)
	_, count = string.gsub(prep, "{{DYKmake|Example|Editor|subpage=", "{{DYKmake|Example|Editor|subpage=")
	return count
end

p.prepfill = function(frame)
	bottom_prep = (tonumber(string.sub(mw.title.new("Did you know/Queue/NextPrep",10):getContent(),1,1))-2)%7+1 --will break if number of preps goes to double digits
	total = 0;
	for i=1,7 do 
		if i ~= bottom_prep then
			page = mw.title.new("Did you know/Preparation area "..i,10):getContent();
			total = total + p.num_empty(page);
		end
	end
	return total
end

return p;