Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
Change to format to hopefully reduce memory load
(Also forcing startID to be a number)
(Change to format to hopefully reduce memory load)
Line 315: Line 315:
    
    
   local rowResult = {}
   local rowResult = {}
  local addedRows = 0
   for i = startID, startID + rowCount, 1 do
   for i, item in Shared.skpairs(ItemData.Items) do
    local item = ItemData.Items[i]
     if i > startID then
     if item == nil then break end
      local rowTxt = '|-\r\n|'..Icons.Icon({item.name, type='item', size='50', notext=true})..'||[['..item.name..']]'
    local rowTxt = '|-\r\n|'..Icons.Icon({item.name, type='item', size='50', notext=true})..'||[['..item.name..']]'
      rowTxt = rowTxt..'||'..(i - 1)..'||'..item.category..'||'..item.type..'||'..Icons.GP(item.sellsFor)
    rowTxt = rowTxt..'||'..(i - 1)..'||'..item.category..'||'..item.type..'||'..Icons.GP(item.sellsFor)
      rowTxt = rowTxt..'||'..ItemSourceTables._getItemSources(item, false, 'false')
    rowTxt = rowTxt..'||'..ItemSourceTables._getItemSources(item, false, 'false')
      rowTxt = rowTxt..'||'..ItemUseTables._getItemUses(item, false, 'false')
    rowTxt = rowTxt..'||'..ItemUseTables._getItemUses(item, false, 'false')
      table.insert(rowResult, rowTxt)
    table.insert(rowResult, rowTxt)
      addedRows = addedRows + 1
      if addedRows >= rowCount then
        break
      end
    end
   end
   end