Module:ItemsTable: Difference between revisions

Fix off by one error when fromItemID == nil
(Improve output of function)
(Fix off by one error when fromItemID == nil)
Line 2: Line 2:
-- run p.getItemsTableAlt() in debug and copy the result to [[Template:ItemsTable]] after an update that adds new items.
-- run p.getItemsTableAlt() in debug and copy the result to [[Template:ItemsTable]] after an update that adds new items.
--[=[
--[=[
mw.log(p.getItemsTableAlt(nil, 60))
p.getItemsTableAlt(nil, 60)
--]=]
--]=]


Line 29: Line 29:
   local itemList = {}
   local itemList = {}
   local rowCount = 0
   local rowCount = 0
   local genRows = false
   local genRows = fromItemID == nil
   local lastItemID = nil
   local lastItemID = nil
   for i, item in ipairs(GameData.rawData.items) do
   for i, item in ipairs(GameData.rawData.items) do