gre.send_event

gre.send_event(
    event,
    [channel]
)
            

Send an event to the application or to a Storyboard IO channel.  channel is an optional parameter and if channel is not passed then the channel will be chosen as follows:

If the environment variable GREIONAME is set then it will be used otherwise the default channel is used.


Parameters:
        event       A string containing the event to send
         OR
           A table containing the following fields:
                 name A string containing the event to send
                 target A string containing the object to target the event to (see Storyboard IO) (optional)
                 format A string format of the event data payload (optional)
                 data A table whose keys match up with the keys specified in the format (optional)
        channel       An optional Storyboard IO channel to send the event on, if not specified the
                      event is added directly into the current Storyboard application event queue
                      if neither the environment variable or global GREIONAME variable are set.

Returns:
        true for success, false for failure and error message string, e.g. "Can't open greio channel my_channel" 

Example:
            

-- Send to the event  to the application :
local success, error = gre.send_event("my_event")
if(success == false) then
    print(error)
    --handle error
end


--To send the event to a Storyboard IO channel via parameters:
local success, error = gre.send_event("my_event", “io_channel_name”)
if(success == false) then
    print(error)
    --handle error
end