sonic-radiance/sonic-radiance.love/game/modules/utils/init.lua

32 lines
729 B
Lua
Raw Normal View History

2019-07-26 17:36:25 +02:00
local gameutils = {}
function gameutils.getMapPath(maptype, mapname)
local dir = gameutils.getMapDirectory(maptype, mapname)
local path = dir .. "map.lua"
core.debug:print("game/utils", "path is " .. path)
return path
2019-07-26 17:36:25 +02:00
end
function gameutils.getMapDirectory(maptype, mapname)
if not gameutils.validateMapType(maptype) then
2019-07-26 17:36:25 +02:00
error("Map type " .. maptype .. " doesn't exist.")
end
return "datas/gamedata/maps/" .. maptype .. "/" .. mapname .. "/"
end
function gameutils.validateMapType(maptype)
local types = {"battle", "sti", "test"}
local validated = false
for i, type in ipairs(types) do
if (type == maptype) then
validated = true
end
end
return validated
end
2019-07-26 17:36:25 +02:00
return gameutils