From 2d4221ecd25d0b2e92153da4b1fda56b5e821264 Mon Sep 17 00:00:00 2001 From: Ivan Yuriev Date: Tue, 25 Mar 2025 21:39:33 +0300 Subject: [PATCH] added a callback to call when loading a file --- asset_bundle.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asset_bundle.lua b/asset_bundle.lua index 6ef99ce..51582e4 100644 --- a/asset_bundle.lua +++ b/asset_bundle.lua @@ -5,7 +5,11 @@ AssetBundle = { files = {} } -function AssetBundle:load() +function AssetBundle:load(onFileLoading) + local onFileLoading = onFileLoading or function(path) + print("[AssetBundle]: loading " .. path) + end + local function enumerate(path) local tree = {} @@ -14,6 +18,7 @@ function AssetBundle:load() local newPath = path .. "/" .. v local type = love.filesystem.getInfo(newPath).type if type == "file" then + onFileLoading(newPath) local data = self.loadFile(newPath) if data:is_some() then tree[self.cutExtension(v)] = data:unwrap()