try to fix scope issue

This commit is contained in:
mollusk 2018-12-12 08:17:44 -07:00
parent dd955b6166
commit 8b350eb9a2
3 changed files with 19 additions and 7 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/julia
include("saveGame.jl")
using Main.saveGame
mutable struct Pilot
Name::String

View File

@ -1,4 +1,13 @@
saveDir = "~/.config/spacetrack"
module saveGame
export savegame,
user,
saveDir,
saveFile
user = ENV["USER"]
saveDir = "/home/$user/.config/spacetrack"
@ -9,9 +18,9 @@ function savegame(
createSave::Bool
)
local io = IOBuffer()
io = IOBuffer()
saveFile = ""
if createSave == true
mkpath(saveDir)
@ -21,10 +30,10 @@ function savegame(
if isempty(saveFileName) == true
global saveFile = untitled.conf
global saveFile = "untitled.conf"
else
saveFile = saveFileName
global saveFile = saveFileName
end
open("$saveDir/$saveFile", "w") do io
@ -39,5 +48,4 @@ function savegame(
return saveFile
end
saveFile = saveFile
end

View File

@ -1,6 +1,9 @@
#!/usr/bin/julia
include("../lib/player.jl")
include("../lib/saveGame.jl")
function main_menu()
create_pilot()