Update onEvent.md
This commit is contained in:
@@ -27,16 +27,17 @@ main:onEvent(function(event, side, channel, replyChannel, message, distance)
|
|||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
The parameters passed to this function are the same as those returned by `os.pullEvent()`. See [here](https://computercraft.info/wiki/Os.pullEvent) for more info.
|
The parameters passed to this function are the same as those returned by `os.pullEvent()`. See [here](https://tweaked.cc/module/os.html#v:pullEvent) for more info.
|
||||||
|
|
||||||
Alternatively, you can add an onEvent event to an XML layout:
|
Alternatively, you can add an onEvent event to an XML layout:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<onEvent>
|
<onEvent>
|
||||||
local eventType = event[3]
|
local eventType = event[2]
|
||||||
local message = event[7]
|
|
||||||
if (eventType == "modem_message") then
|
if (eventType == "modem_message") then
|
||||||
basalt.debug("Message received: " .. tostring(message))
|
local message = event[6]
|
||||||
|
basalt.debug("Message received: " .. message)
|
||||||
end
|
end
|
||||||
</onEvent>
|
</onEvent>
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user