trainworld_computercraft/computer/1/startup.lua
2025-05-27 03:02:53 +02:00

27 lines
787 B
Lua

local filename = "tobuild"
rednet.open("left")
while true do
id, message, protocol = rednet.receive()
if protocol == "getnexttobuild" then
file = fs.open(filename,"r")
line = file.readLine()
restof = file.readAll()
file.close()
file = fs.open(filename,"w")
file.write(restof)
file.close()
print(line)
rednet.send(id,line,"nexttobuild")
elseif protocol == "failedtobuild" then
print(message.."failed")
file = fs.open(filename,"r")
restof = file.readAll()
file.close()
file = fs.open(filename,"w")
file.writeLine(message)
file.write(restof)
file.close()
end
--file = fs.open(filename,"r")
--print(file.readAll())
end