gobj_create()
#
Creates a new gobj
(generic object) instance of the specified gclass
and assigns it to a parent gobj
if provided.
Prototype
hgobj gobj_create(
const char *gobj_name,
gclass_name_t gclass_name,
json_t *kw, // owned
hgobj parent
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The name of the |
|
|
The name of the |
|
|
A JSON object containing configuration parameters for the |
|
|
The parent |
Return Value
Returns a handle to the newly created gobj
(hgobj
). Returns NULL
if the creation fails due to invalid parameters or memory allocation failure.
Notes
[‘The function internally calls gobj_create2()
with default flags.’, ‘If gobj_name
is longer than 15 characters on ESP32, the function will abort execution.’, ‘If gclass_name
is empty or not found, an error is logged and NULL
is returned.’, “The function ensures that gobj_name
does not contain invalid characters such as ‘' or '^'.", 'If
parentis
NULL, an error is logged unless the
gobj` is a Yuno instance.’]
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples