【发布时间】:2022-12-20 23:30:47
【问题描述】:
完整的代码本身非常复杂、冗长,而且是新手编写的;我正在尝试通过 rednet 从计算机将 x 和 z 坐标发送到单独的接收器乌龟。
接收者
rednet.broadcast("Awaiting Input!")
xAxis = rednet.receive() --Have tried tonumber(rednet.receive()) on both same result
zAxis = rednet.receive()
rednet.broadcast(xAxis) --Both values return 2 regardless of what I enter in the sender.
rednet.broadcast(zAxis)
发件人
if(irrelevant == "genericstringhere") then
print(rednet.recieve()) --Awaiting Input!
io.write("X Axis: ") --Pizzaz
message = io.read() --Have tried using terms like X and xAxis.
rednet.broadcast(message) --Broadcast whatever tf I typed in.
sleep(0.3)
io.write("Z Axis: ") --More Pizzaz
message = io.read() --Have tried using terms like Z or zAxis
rednet.broadcast(message) --Broadcast whatever tf I typed in. again.
print(rednet.receive()) --Receive xAxis value from sender.
print(rednet.receive()) --Receive zAxis value from sender.
end
执行结束时的两个结果都返回 2,而不是我在 io.read() 中输入的值。我试过 tonumber()、tostring() 以及两者的每一个组合,但我似乎无法让它工作。
【问题讨论】:
标签: lua computercraft