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


Defines the properties of a Type. Function set_type works only on a new Type. Use mod_type() if you want to change an existing Type, see mod_type.

This function generates an event.


set_type(type, value, [wrap_only])


Argument Type Description
type str The name of the Type where the properties have to be set.
value thing Thing containing all the properties to be set.
wrap_only bool (optional) When true the type will be configured with wrap-only mode enabled. Default is false for a new type, or untouched if the type already existed.

If wrap-only mode is enabled, no instances of this type can be created nor can the type be used by other type unless they also have wrap-only mode enabled. In wrap-only mode the only purpose of the type is to wrap other things.

Return value

The value nil.


This code shows how to use set_type():

set_type('Person', {
    name: 'str',
    age: 'uint',
    hobbies: '[str]'

Return value in JSON format