Skip to main content
Version: 9.0.2

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

ParameterTypeDescription
channel#stringA Storyboard IO channel to receive the event on.

Returns

A #table containing the following fields for a received event:

KeyTypeDescription
name#stringThe name of the received event
target#stringThe name of the model object receiving this event.
format#stringThe format string defining the event data payload.
data#tableThe 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)