Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = { ... }
- -- Usage if a Command is wrong
- function usage()
- print("usage: timetable x name newname")
- print("example: timetable 1 name newname")
- end
- -- finding Train Station
- if peripheral.find("Create_Station") then
- trainstation = peripheral.find("Create_Station")
- else
- print("no trainstation found")
- return
- end
- -- checking if enough arguments are present
- if #tArgs <= 2 then
- if #tArgs == 1 then
- if tArgs[1] == "get" then
- else
- usage()
- return
- end
- else
- usage()
- return
- end
- end
- -- setting variables to get the chaos sorted
- entry = tonumber(tArgs[1])
- object = tArgs[2]
- new = tArgs[3]
- -- checking the arguments and respond if right
- -- getting train schedule
- schedule = trainstation.getSchedule()
- if object == "name" then
- print("actual name: "..schedule.entries[entry].instruction.data.text)
- schedule.entries[entry].instruction.data.text = new
- trainstation.setSchedule(schedule)
- print("New Station Name of Entry "..entry.." is "..new)
- elseif tArgs[1] == "get" then
- print(#schedule.entries.." Entries Found")
- entrys=#schedule.entries
- for i=1,entrys do
- print("Station "..i..": "..schedule.entries[i].instruction.data.text)
- end
- else
- print(entry)
- print(object)
- print(new)
- end
Advertisement
Add Comment
Please, Sign In to add comment