function ExportLevel(levelname) filename = "output.lua" local success, message = love.filesystem.write(filename, "") if success then love.filesystem.append(filename, "return {") love.filesystem.append(filename, "\n name = \"" .. levelname .. "\",") for k, v in pairs(tileset) do if v == LevelData.tileset then love.filesystem.append(filename, "\n tileset = tileset." .. k .. ",") end end love.filesystem.append(filename, "\n tiles = {") for i = 1, #LevelTiles do love.filesystem.append(filename, "\n { ") for j = 1, #LevelTiles[i] do if j ~= 1 then love.filesystem.append(filename, ", ") end love.filesystem.append(filename, tostring(LevelTiles[i][j].id)) end love.filesystem.append(filename, "}") if i ~= #LevelTiles then love.filesystem.append(filename, ", ") end end love.filesystem.append(filename, "\n },") love.filesystem.append(filename, "\n objects = {}") love.filesystem.append(filename, "\n}") end end --[[ return { name = "level1", tileset = tileset.library, tiles = { {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 5,25,26, 6,25,26, 7, 0, 5,25,26, 7, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 5,49,50, 6,49,50, 7, 0, 5,49,50, 7, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }, objects = {} } ]] logFile = "mothback_"..os.date("%Y-%m-%d_%H-%M-%S")..".log" local success, message = love.filesystem.write(logFile, "") if message ~= nil then print(message) end