Hello again.
How i can delete chink from code : chunk = love.filesystem.load ( name )?
My game spends more RAM and i want delete graphics with RAM after exit from locations.
Example:
I have 2 locations:
I entered in 1 location and i load graphics and code for this location. -> i left 1 location and i want delete source for 1 location and load source for 2 location.
How i can get it?
Sorry for my english
Delete chunk - love.filesystem.load
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Delete chunk - love.filesystem.load
You can simply unset the variable(s) that holds the graphic and the garbage collector will pick it up. Just make sure you get rid of all the references if there are multiple.
Code: Select all
img = love.graphics.newImage( 'someImage.png' )
if level == 2 then
img = nil -- this will remove the image from memory
end
Re: Delete chunk - love.filesystem.load
Good.
Can i delete all table in one moment?
table = {
img 1 = love.graphics.newImage( 'someImage1.png' )
img 2 = love.graphics.newImage( 'someImage2.png' )
}
Can i make it through "for"?
And this:
dosn't work
Can i delete all table in one moment?
table = {
img 1 = love.graphics.newImage( 'someImage1.png' )
img 2 = love.graphics.newImage( 'someImage2.png' )
}
Can i make it through "for"?
And this:
Code: Select all
img = nil
Re: Delete chunk - love.filesystem.load
You can remove the entire table by just setting the table to nil (but again, make sure you've removed all references to it)
(Also it's a very bad idea to make a variable called table, because table is a default variable with a bunch of functions and you'll probably destroy some libraries. But I'm assuming this is just an example.)
What isn't working about img = nil ?
Code: Select all
table = nil
What isn't working about img = nil ?
Re: Delete chunk - love.filesystem.load
I delete all tables from 2 location and run again this and i take error what can't read table, but when i entered in location 2 i use require ( file ) where i keep all tables.
Maybe i need use love.filesystem.load instead of require?
Maybe i need use love.filesystem.load instead of require?
Re: Delete chunk - love.filesystem.load
When you do
then the varaible "table" does not exist anymore. Try instead. This should replace the original table by an empty table.
Code: Select all
table = nil
Code: Select all
table = {}
Check out my blog on gamedev
Re: Delete chunk - love.filesystem.load
Yes, i now.
But my code "require (file)" itself contains again it tables.
Nope. Again error.
But my code "require (file)" itself contains again it tables.
Code: Select all
table = {}
Re: Delete chunk - love.filesystem.load
Can you post the .love file so we can have a look?
Re: Delete chunk - love.filesystem.load
My game weighs ~60 mb...
But 1 minutes, i create test for you.
But 1 minutes, i create test for you.
Re: Delete chunk - love.filesystem.load
Here test file.
Left click - enter in next game mode, right click - previous game mode.
Need that after enter in first game mode - sun deleted from ram and in again i'm enter in second mode - sun again load.
Left click - enter in next game mode, right click - previous game mode.
Need that after enter in first game mode - sun deleted from ram and in again i'm enter in second mode - sun again load.
- Attachments
-
- test.love
- (5.16 MiB) Downloaded 242 times
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests