This is the ThingsDB documentation for version v0, click here for the latest version!

thing

Returns a thing from a specified value, that may be dynamic. If no value is given, a new thing is returned.

This function does not generate an event.

Function

thing([id])

Arguments

Argument Type Description
id int (optional) The Id for the thing to return.

Return value

Returns a thing. A lookup_err() is returned in case an Id is given which is not found inside the collection.

Example

This code shows an example usage of thing():

.greet = "Hello world!";
[
    thing(.id()),
    thing(),
];

Example return value in JSON format

[
    {
        "#": 42,
        "greet": "Hello world!"
    },
    {}
]