Difference between revisions of "Module:Prize pack droppers"
From ALttP Speedrunning Wiki
(Created page with "local p = {} function p.main(frame) local args = frame:getParent().args local mobs = {} for i, v in ipairs(args) do mobs[i] = v end return _main(mobs) end function...") |
|||
Line 13: | Line 13: | ||
end | end | ||
− | function _main(mobs) | + | function p._main(mobs) |
− | local ret = { } | + | local ret = {} |
for i, v in ipairs(mobs) do | for i, v in ipairs(mobs) do | ||
Line 23: | Line 23: | ||
table.insert(make_mob_line(v)) | table.insert(make_mob_line(v)) | ||
+ | end | ||
+ | |||
+ | local remainder = 8 - (#mobs % 8) | ||
+ | |||
+ | if remainder ~= 8 then | ||
+ | table.insert('! colspan="' .. remainder .. '" | ') | ||
end | end | ||
Revision as of 14:07, 13 June 2018
Documentation for this module may be created at pack droppers/doc&action=edit&redlink=1 Module:Prize pack droppers/doc
local p = {} function p.main(frame) local args = frame:getParent().args local mobs = {} for i, v in ipairs(args) do mobs[i] = v end return _main(mobs) end function p._main(mobs) local ret = {} for i, v in ipairs(mobs) do if (i % 8) == 0 then table.insert(ret, '-') end table.insert(make_mob_line(v)) end local remainder = 8 - (#mobs % 8) if remainder ~= 8 then table.insert('! colspan="' .. remainder .. '" | ') end return table.concat(ret, '\n') end function make_mob_line(mob) return '-' .. mob end return p