This adds a timer(<seconds>) function, which causes an event of type
"timer" to be fired after that many seconds has elapsed.
Because it's node timer based, it works properly across server restarts
and block unloading. Thus, simplest example, a blinky plant replacement
with a 10 second period:
if event.type == "program" then
timer(10)
elseif event.type == "timer" then
port.a = not port.a
timer(10)
end
Example of problem fixed by this: Edit lua code, press Execute. Now
(execute button has focus), hold down a key. Zillions of "program"
events are generated.
In the same way as for port settings, this queues up digiline messages
sent during the luacontroller's execution, and sends them afterwards.
This solves many problems, but one example:
1. Send a message, and receive a reply from another device.
2. While handling the reply event (effectively a nested invocation
on the same luacontroller) make a change to memory
3. Notice that the memory change has no effect, because after
completion of the reply handling, it stores the memory, but then
the original invocation completes and overwrites it with it's
own earlier copy of the same memory.
This introduces the ActionQueue, a new kind of MESECONS_GLOBALSTEP.
Circuits using delayers will now resume when restarting the server.
Also, large circuits should automatically resume if parts of them are
in unloaded chunks.
Old circuits e.g. using gates will not resume when mesecons is updated,
which means you have to restart them once. But after that, it should work
just like it used to.
This will fix a lot of stuff but may also introduce some new bugs.
So please report them!
same time (output connected to input).
The behaviour of the controller can now be described this way:
The luacontroller sets port A, then B, then C, then D; if it is
interrupted by another event during that time it stops and let the
second event do the job.
certain amount of time.
Whenever it is called, an event is set.
Possible events are: program, interrupt, on and off
It also contains additional information (on/off -> event.in; interrupt ->
event.iid)
iid must be an integer or string value, otherwise the interrupt is not active
It still misses some functionality such as a persistent memory and a
timer, but that is subject to change. The code runs in a sandbox.
Speaking long term this will hopefully replace the old controller.