View difference between Paste ID: jPdni2Lx and Fxamez1p
SHOW: | | - or go back to the newest paste.
1
local args = {...}
2
local filePath = args[1]
3
if filePath == nil then
4
    print("ERROR: Please specify a file location.")
5
    return
6
end
7-
local color = tonumber(args[2])
7+
8
local station = peripheral.find("Create_Station")
9
local file = fs.open(filePath, "r")
10-
local schedule = station.getSchedule()
10+
local body = file.readAll()
11-
schedule["progress"] = nil
11+
12-
if color ~= nil then
12+
local schedule = textutils.unserialize(body)
13-
	schedule["color"] = color
13+
schedule["color"] = nil
14
station.setSchedule(schedule)
15-
local file = fs.open(filePath, "w")
15+
print("Successfully set train schedule to \""..filePath.."\".")