forked from EratoNysiad/ScheduledDispatchScheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
saveHandling.lua
46 lines (44 loc) · 1.13 KB
/
saveHandling.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function saveMasterFile()
local masterFileData = ""
for i=1, (numTimeTables+1)*masterFileLength do
local currentBit = timeTableData[0][i-1]
if currentBit == nil then
textToPrint = i
else
masterFileData = masterFileData..currentBit
if timeTableData[0][i]~=nil or i~=(numTimeTables+1)*masterFileLength-1 then
if i%masterFileLength == 0 then
masterFileData = masterFileData .. '\n'
else
masterFileData = masterFileData .. ','
end
end
end
end
love.filesystem.write( 'ttdata/ttmf.dat', masterFileData )
end
function saveTimeTable(k)
local ttFileData = ""
for i=1, (numStops[k]+1)*timeTableFileLength do
local currentBit = timeTableData[k][i-1]
if currentBit == nil then
textToPrint = i
else
ttFileData = ttFileData..currentBit
if timeTableData[k][i]~=nil then
if i%timeTableFileLength == 0 then
ttFileData = ttFileData .. '\n'
else
ttFileData = ttFileData .. ','
end
end
end
end
love.filesystem.write( 'ttdata/'..timeTableData[0][k*masterFileLength]..'.dat', ttFileData )
end
function saveToFile()
saveMasterFile()
for i=1, numTimeTables do
saveTimeTable(i)
end
end