trainworld_computercraft/computer/1/startup.lua
2025-05-28 02:37:55 +02:00

27 lines
778 B
Lua

local filename = "tobuild"
rednet.open("left")
while true do
id, messages, 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(messages.."failed")
file = fs.open(filename,"r")
restof = file.readAll()
file.close()
file = fs.open(filename,"w")
file.writeLine(messages)
file.write(restof)
file.close()
end
--file = fs.open(filename,"r")
--print(file.readAll())
end