Difference between revisions of "Module:Used by/Sandbox"
Line 19: | Line 19: | ||
local first = table.remove(args, 0) | local first = table.remove(args, 0) | ||
− | count = | + | count = count - 1 |
if first == 'all' then | if first == 'all' then | ||
return common_string{'infobox-used-by-all'} | return common_string{'infobox-used-by-all'} |
Revision as of 06:19, 18 March 2023
Documentation for this module may be created at Module:Used by/Sandbox/doc
local p = {} function common_string(args) return mw.getCurrentFrame():expandTemplate{title='Common string', args=args} end function p.classes(frame) local args = frame.args local count = 0 for _ in pairs(args) do count = count + 1 end if count == 0 then args = frame:getParent().args for _ in pairs(args) do count = count + 1 end end local first = table.remove(args, 0) count = count - 1 if first == 'all' then return common_string{'infobox-used-by-all'} elseif first == 'all-except' then return common_string{'infobox-used-by-all-except-' .. count, unpack(args)} else return common_string{'infobox-used-by-' .. count, unpack(args)} end end return p