gclass_add_state_with_action_list()

gclass_add_state_with_action_list()#

Adds a new state to the given gclass and associates it with a list of event-action mappings.

Prototype

int gclass_add_state_with_action_list(
    hgclass         gclass,
    gobj_state_t    state_name,
    ev_action_t     *ev_action_list
);

Parameters

Key

Type

Description

gclass

hgclass

The gclass to which the state and event-action mappings will be added.

state_name

gobj_state_t

The name of the new state to be added.

ev_action_list

ev_action_t *

A pointer to an array of event-action mappings that define the behavior of the new state.


Return Value

Returns 0 on success, or -1 if an error occurs (e.g., if the state could not be added).

Notes

This function first adds the state using gclass_add_state(). Then, it iterates through ev_action_list to associate each event with an action and a next state using gclass_add_ev_action().

Prototype

// Not applicable in JS

Prototype

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