gre.receive_event
gre.receive_event(
channel
)
Receive an event from a Storyboard IO channel. This is a blocking call and works best when used on a separate Lua thread.
Parameters
| Parameter | Type | Description |
|---|---|---|
channel | #string | A Storyboard IO channel to receive the event on. |
Returns
A #table containing the following fields for a received event:
| Key | Type | Description |
|---|---|---|
name | #string | The name of the received event |
target | #string | The name of the model object receiving this event. |
format | #string | The format string defining the event data payload. |
data | #table | The data from received event. |
Example
-- Receive a Storyboard IO event with data payload x, y, z:
ev = gre.receive_event("my_channel")
if ev ~= nil then
print(ev.name)
for k,v in pairs(ev.data) do
print(tostring(k).." "..tostring(v))
end
end
--To disconnect from my_channel:
gre.greio_disconnect("my_channel", true)