CTLD - fix when using SAVE or LOAD w/o filename and path

This commit is contained in:
Applevangelist 2021-09-21 07:48:09 +02:00
parent cfed6f5153
commit 663cd34aa3

View File

@ -962,7 +962,7 @@ CTLD.UnitTypes = {
--- CTLD class version. --- CTLD class version.
-- @field #string version -- @field #string version
CTLD.version="0.2.1a2" CTLD.version="0.2.1a3"
--- Instantiate a new CTLD. --- Instantiate a new CTLD.
-- @param #CTLD self -- @param #CTLD self
@ -4084,6 +4084,10 @@ end
end end
end end
-- Set file name and path
filename=filename or self.filename
path = path or self.filepath
-- Check io module is available. -- Check io module is available.
if not io then if not io then
self:E(self.lid.."WARNING: io not desanitized. Cannot load file.") self:E(self.lid.."WARNING: io not desanitized. Cannot load file.")
@ -4100,9 +4104,6 @@ end
path=path or lfs.writedir() path=path or lfs.writedir()
end end
-- Set file name.
filename=filename or self.filename
-- Set path. -- Set path.
if path~=nil then if path~=nil then
filename=path.."\\"..filename filename=path.."\\"..filename
@ -4114,8 +4115,9 @@ end
if exists then if exists then
return true return true
else else
self:E(self.lid..string.format("WARNING: State file %s does not exist.", filename)) self:E(self.lid..string.format("WARNING: State file %s might not exist.", filename))
return false return false
--return self
end end
end end
@ -4140,14 +4142,15 @@ end
return data return data
end end
-- Set file name and path
filename=filename or self.filename
path = path or self.filepath
-- Set path or default. -- Set path or default.
if lfs then if lfs then
path=path or lfs.writedir() path=path or lfs.writedir()
end end
-- Set file name.
filename=filename or self.filename
-- Set path. -- Set path.
if path~=nil then if path~=nil then
filename=path.."\\"..filename filename=path.."\\"..filename