It's not an issue with Love.
The garbage is coming from the backpack.draw function. It looks like you keep adding buttons forever. I end up with about 2000 buttons in backpack.buttons.list in a few seconds. You need to remove them from the list as you add more. Comment it out on line 188 of main.lua to see for yourself.
This is the shortest possible (albeit less than ideal) fix:
Code: Select all
function backpack.draw()
backpack.buttons.list = {}
for x = 0,9 do
if backpack.selectedId == x+1 then
love.graphics.draw(images.hotBarBox,screenSize.X/2-272+(54*x),screenSize.Y-67,0,1,1)
end
love.graphics.draw(images.backpackBox,screenSize.X/2-270+(54*x),screenSize.Y-65,0,1,1)
if backpack.hotBar[x+1].block ~= nil then
local subSize = data.itemInfo[backpack.hotBar[x+1].block].size or Vector2.new(2,2)
local subSize = math.max(subSize.X,subSize.Y)/2
love.graphics.draw(images[backpack.hotBar[x+1].block],screenSize.X/2-267+(54*x),screenSize.Y-65+3,0,.46/subSize,.46/subSize)
end
backpack.buttons.addButton(Vector2.new(screenSize.X/2-276+(54*x),screenSize.Y-65+4,0),Vector2.new(.46*100,.46*100),{part = 'hotBar',index = x+1})
end
if backpack.show then
love.graphics.setColor(25,25,25,210)
love.graphics.rectangle('fill',backpack.UIOFFSET.X-6,backpack.UIOFFSET.Y-6,backpack.UISIZE.X*108*10+12,backpack.UISIZE.Y*108*3+12)
love.graphics.setColor(255,255,255)
--love.graphics.draw(images.backpackBackground,screenSize.X/2-490,screenSize.Y/2-308)
for x = 0,9 do
for y = 0,2 do
local size = backpack.UISIZE
love.graphics.draw(images.backpackBox,backpack.UIOFFSET.X+(size.X*108*x),backpack.UIOFFSET.Y+(size.Y*108*y),0,2*size.X,2*size.Y)
local index = x+1+(y*10)
if backpack.items[index].block ~= nil then
local subSize = data.itemInfo[backpack.items[index].block].size or Vector2.new(2,2)
local subSize = math.max(subSize.X,subSize.Y)/2
love.graphics.draw(images[backpack.items[index].block],backpack.UIOFFSET.X+4+(size.X*108*x),backpack.UIOFFSET.Y+4+(size.Y*108*y),0,backpack.UISIZE.X*.96/subSize,backpack.UISIZE.Y*.96/subSize)
love.graphics.printf(backpack.items[index].amount,backpack.UIOFFSET.X+4+(size.X*108*x),backpack.UIOFFSET.Y+4+(size.Y*108*(y+1))-28,backpack.UISIZE.X*.96/subSize*100,'right')
end
backpack.buttons.addButton(Vector2.new(backpack.UIOFFSET.X+4+(size.X*108*x),backpack.UIOFFSET.Y+4+(size.Y*108*y)),Vector2.new(backpack.UISIZE.X*.96*100,backpack.UISIZE.Y*.96*100),{part = 'backpack',index = index})
--love.graphics.draw(images.backpackBox,screenSize.X/2-490+24+(108*x),screenSize.Y/2-308+24+(108*y),0,2,2)
end
end
if backpack.mouse.block ~= nil then
local subSize = data.itemInfo[backpack.mouse.block].size or Vector2.new(2,2)
local subSize = math.max(subSize.X,subSize.Y)/2
love.graphics.draw(images[backpack.mouse.block],mouse.X,mouse.Y,0,backpack.UISIZE.X*.96/subSize,backpack.UISIZE.Y*.96/subSize)
end
end
end
Using this the memory usage stays at 5MB. I hope this was helpful.