Loader¶
The Loader module is responsible for loading additional resources into the engine.
Reference¶
- loader.getItemCountToLoad()¶
Return how many items are currently beeing loaded
- loader.loadImage(path)¶
Loads an image from an item by its relative path
- loader.loadMaterial(path)¶
Loads a material by path and will emit an loadMaterialResult event when the material is ready or loadMaterialError event on error
- loader.loadMesh(path)¶
Loads a mesh from an item by its relative path.
- loader.loadPrefab(path)¶
Loads a prefab from an item by its relative path.
Examples¶
Load a texture¶
local Loader = require 'engine/loader'
function init()
Loader.loadImage("/resources/textures/mytexture"):next(function(texture)
print("Loaded the texture: ", texture:getName())
end)
end