spacetrack/lib/saveGame.jl

43 lines
770 B
Julia
Raw Normal View History

2018-11-20 17:23:43 -07:00
saveDir = "~/.config/spacetrack"
function savegame(
playerid::String,
playerName::String,
shipName::String,
createSave::Bool
)
local io = IOBuffer()
if createSave == true
mkpath(saveDir)
print("Name youe save file: ")
saveFileName = readline()
if isempty(saveFileName) == true
global saveFile = untitled.conf
else
saveFile = saveFileName
end
open("$saveDir/$saveFile", "w") do io
write(io, "player-id = ", playerid, "\n")
write(io, "pilot-name = ", playerName, "\n");
write(io, "ship-name = ", shipName, "\n");
end;
close(io)
end
return saveFile
end
saveFile = saveFile