Module bank_images
Loads and caches images by path, freeing each image after its last release.
Info:
- Author: Sharper Dev
Functions
| ImagesBank.loadImage (path) | Loads an image or increments its reference count if it is already cached. |
| ImagesBank.unloadImage (path) | Releases one reference to the image and frees it when the count reaches zero. |
Functions
- ImagesBank.loadImage (path)
-
Loads an image or increments its reference count if it is already cached.
Pair each call with unloadImage using the same path.
Parameters:
- path string Path to the image file.
Returns:
-
image_id The loaded image handle.
Usage:
local image = ImagesBank.loadImage("romfs:/images/player.png")
- ImagesBank.unloadImage (path)
-
Releases one reference to the image and frees it when the count reaches zero.
Does nothing if the path is not cached.
Parameters:
- path string Path used to load the image.
Usage:
ImagesBank.unloadImage("romfs:/images/player.png")