diff --git a/sonic-radiance.love/game/modules/utils/init.lua b/sonic-radiance.love/game/modules/utils/init.lua index 93643fb..59f0b57 100644 --- a/sonic-radiance.love/game/modules/utils/init.lua +++ b/sonic-radiance.love/game/modules/utils/init.lua @@ -8,11 +8,24 @@ function gameutils.getMapPath(maptype, mapname) end function gameutils.getMapDirectory(maptype, mapname) - if (maptype ~= "battle") and (maptype ~= "sti") then + if not gameutils.validateMapType(maptype) then error("Map type " .. maptype .. " doesn't exist.") end return "datas/gamedata/maps/" .. maptype .. "/" .. mapname .. "/" end +function gameutils.validateMapType(maptype) + local types = {"battle", "sti"} + local validated = false + + for i, type in ipairs(types) do + if (type == maptype) then + validated = true + end + end + + return validated +end + return gameutils