2 posts
Posted 10 March 2016 - 06:51 PM
I wonder if it is possible to receive a message and send one at the same time?
I want it to send the data ALL THE TIME to the monitor, But it gets stuck at the receive. Any workaround without having two computers?
Reactor program:
http://pastebin.com/K6B8FCrK
212 posts
Location
Somewhere in this dimension... I think.
Posted 10 March 2016 - 08:05 PM
Technically not possible because of how Computercraft (and probably LuaJ) works, but doing something along the lines of the parallel API would probably suit your needs (also make sure you need what you think you need, you probably can have slower updates but I don't know what you need)
Edited on 10 March 2016 - 07:05 PM
8543 posts
Posted 10 March 2016 - 08:46 PM
No, it's perfectly possible to do what's actually being asked about. You'd want to structure your program to use an event handling loop. You'd use a timer event (or key/char events, or whatever generates the data to send) to determine when to send rednet messages, and you'd handle incoming rednet_message events in the same loop.
212 posts
Location
Somewhere in this dimension... I think.
Posted 11 March 2016 - 07:53 PM
I added technically referring to the nature of blocking in ComputerCraft, while recognizing that, giving a minuscule downtime that is more than likely impactless, it is still possible to do as requested.
8543 posts
Posted 11 March 2016 - 10:16 PM
There's no meaningful "downtime" anyway. You have to yield regardless, so the code already has no way to consume 100% of the server's CPU time. And yes, updating once per second will be more than sufficient for reactor stats displays.