set_type

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 a change.

Function

set_type(type, value, [wrap_only, [hide_id]])

Arguments

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.
hide_id bool (optional) When true the new type will be created with hide-id enabled. Default is false. See “hid” action on mod_type for more information.

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.

Example

This code shows how to use set_type():

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

Return value in JSON format

null