diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/textures.lua | 2 | ||||
| -rw-r--r-- | src/utils.lua | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/textures.lua b/src/textures.lua index 8cf98a8..b58f762 100644 --- a/src/textures.lua +++ b/src/textures.lua @@ -72,7 +72,7 @@ function load_textures_from(path) if lf.getInfo(filepath).type == "directory" then load_textures_from(filepath) else - if filepath:match("%.png$") then + if is_filetype(filepath, {"png"}) then img_bank[filepath] = lg.newImage(filepath) elseif filepath:match("%.ase$") then load_ase(filepath) diff --git a/src/utils.lua b/src/utils.lua index 1f388cc..5795592 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -1,4 +1,15 @@ +function is_filetype(filename, types) + types = types or {} + + for _, type in ipairs(types) do + if filename:match("%."..type.."$") then + return true + end + end + return false +end + function randf_range(max, min) return math.random() * (max - min) + min end |
