summaryrefslogtreecommitdiff
path: root/mesecons_luacontroller/help/interrupts.txt
blob: 3c5e54ff6a6055b21f4460d8cca3cee7bc8304ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Interrupts
==========

Interrupts allow you to schedule an event to occur later. You can also specify an interrupt ID (IID) for use in keeping track of multiple pending interrupts at the same time.

To schedule an interrupt, use the interrupt() function.
Example:
interrupt(5,"test") --In 5 seconds, an interrupt will occur with the IID "test"

Setting a third parameter to true will cause the interrupt to be "lightweight", where timing stops if the mapblock containing the Luacontroller is unloaded, and automatically resumes when it is loaded again. This stops machines from continously running when no players are in the area.
Example:
interrupt(5,"test",true) --Same as above, but lightweight

Lightweight mode does have a few differences - timing resolution is limited to one second, however pending interrupts can also be canceled by specifying a nil time and the same IID as previously.
Some servers may force all interrupts to be lightweight.

When an interrupt's time expires, an event occurs.
Example:
{
	type = "interrupt",
	iid = "test"
}