diff --git a/Basalt/libraries/images.lua b/Basalt/libraries/images.lua index ce6ac00..a8caaa8 100644 --- a/Basalt/libraries/images.lua +++ b/Basalt/libraries/images.lua @@ -27,24 +27,29 @@ local function loadBBFAsBimg(path) end -local function loadImage(path, f, binaryMode) - if(sub(path, -4) == ".bimg")then +local function loadImage(path, binaryMode) + --Loads the image with the right loader, returns error if the file type is unknown. + if(sub(path, -5) == ".bimg")then return loadBIMG(path, binaryMode) - elseif(sub(path, -3) == ".bbf")then - return loadBBF(path, binaryMode) + elseif(sub(path, -4) == ".bbf")then + return loadBBF(path) + elseif(sub(path, -4) == ".nfp")then + return loadNFP(path) else - return loadNFP(path, binaryMode) + error("Unknown file type") end - -- ... end -local function loadImageAsBimg(path) - if(path:find(".bimg"))then - return loadBIMG(path) - elseif(path:find(".bbf"))then +local function loadImageAsBimg(path, binaryMode) + --Loads the image with the right Bimg loader, returns error if the file type is unknown. + if(sub(path, -5) == ".bimg")then + return loadBIMG(path, binaryMode) + elseif(sub(path, -4) == ".bbf")then return loadBBFAsBimg(path) - else + elseif(sub(path, -4) == ".nfp")then return loadNFPAsBimg(path) + else + error("Unknown file type") end end