I'm trying to save multiple arrays to the same file, but to read them successfully I need to know how to add a new line to the file.
code used for saving:
code used for loading:
code used for saving:
Quote:
f = io.output (MobFileName)
c = 0
if ArrayListAll() then
for k, a in pairs (ArrayListAll ()) do
if ArrayKeyExists (a, "Type") then
if ArrayGet (a, "Type") == "Mob" then
c = c + 1
f:write (ArrayExport (a, ";"))
end -- if
end -- if
end -- for
end -- if
f:close ()
f = io.output (MobFileName)
c = 0
if ArrayListAll() then
for k, a in pairs (ArrayListAll ()) do
if ArrayKeyExists (a, "Type") then
if ArrayGet (a, "Type") == "Mob" then
c = c + 1
f:write (ArrayExport (a, ";"))
end -- if
end -- if
end -- for
end -- if
f:close ()
code used for loading:
Quote:
f = io.input (MobFileName)
c = 0
repeat
s = f:read ("*l")
if s then
ArrayImport (ArrID,s,";")
some code here to process data
ArrayClear (ArrID)
c = c + 1
end -- if
until not s
f:close ()
f = io.input (MobFileName)
c = 0
repeat
s = f:read ("*l")
if s then
ArrayImport (ArrID,s,";")
some code here to process data
ArrayClear (ArrID)
c = c + 1
end -- if
until not s
f:close ()