gobj_send_event()

gobj_send_event()#

The gobj_send_event function processes an event in the given destination gobj, executing the corresponding action in its current state.

Prototype

int gobj_send_event(
    hgobj        dst,
    gobj_event_t event,
    json_t       *kw,
    hgobj        src
);

Parameters

Key

Type

Description

dst

hgobj

The destination gobj that will process the event.

event

gobj_event_t

The event to be processed.

kw

json_t *

A JSON object containing event-specific data. The ownership is transferred to the function.

src

hgobj

The source gobj that is sending the event.


Return Value

Returns 0 on success, -1 if the event is not defined in the current state, or if an error occurs.

Notes

If the event is not found in the current state of dst, the function checks if dst has a custom event injection method (mt_inject_event). If defined, it delegates event processing to that method.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples