Type Function Object TextureResource Library graphics.* Revision Release 2024.3703 See also graphics.releaseTextures() TextureResource
The graphics.newTexture() API texture:releaseSelf()
.
Alternatively, in a wider scope, graphics.releaseTextures() can be used to release all texture objects sharing the same type parameter.
After texture:releaseSelf()
is called, only the texture
handle is released and becomes invalid. All display objects which are using the TextureResource will hold on to their handles. The TextureResource itself will only be disposed after there are no display objects using it.
local texture = graphics.newTexture( { type="image", filename="background.png" } ) -- If you no longer need the texture, release it to prevent memory leaks texture:releaseSelf()