Object Methods

cfgversion

obj:cfgversion()

Description

Returns the configuration version of the object.

Examples

obj = inmation.getobject("/System/Core/object")
configversion = obj:cfgversion()

child

obj:child()

Description

Takes the name of a child (a.k.a. the ObjectName property) and returns it as an inmation object. It returns nil if the named child does not exist.

Examples

obj = inmation.getobject("/System/localhost/object")
child = obj:child("child1")

children

obj:children()

Description

Returns a table containing all the direct children as inmation objects.

Examples

obj = inmation.getobject("/System/localhost/object")
children = obj:children()
paths = {}
for _,c in pairs(children) do
    table.insert(paths, c:path())
end
return paths

classversion

obj:classversion()

Description

Returns the class version of the object (e.g. "2.568").

Examples

obj = inmation.getobject("/System/CORE/object")
classversion = obj:classversion()

commit

obj:commit()

Description

See the examples for the functions inmation.createobject() and inmation.getobject().

created

obj:created()

Description

Returns three values related to object creation information:

  • the UTC timestamp (as posix time) representing the moment of creation

  • the means of creation (e.g. "system", "gui")

  • the account used to create the object (e.g. "INMATIONDEV/TIK")

enabled

obj:enabled()

Description

Returns true if the object is enabled and false otherwise.

good

obj:good()

Description

Returns true if the object is in overall good state and false otherwise.

modified

obj:modified()

Description

Returns the same three values as the created method does, only that they concern last modification information.

numid

obj:numid()

Description

Returns the numerical ID of the object (e.g. 281475465543680).

parent

obj:parent()

Description

Returns the parent of an object as an inmation object.

Examples

obj = inmation.getobject("/System/localhost/object")
parent = obj:parent()
return parent:path()

path

obj:path()

Description

Returns the path of an inmation object.

Examples

obj = inmation.getobject("/System/localhost/object")
path = obj:path()

refs

obj:refs()

Description

This is a field corresponding to a table that can be used for creating and modifying the references of an inmation object. Each entry in this table is itself a table, corresponding to one reference. Each reference has three fields: name, path, and type. Only the path field is mandatory.

Examples

The following is an example how references can be set on a new object:

local a = inmation.createobject("/System/localhost", "MODEL_CLASS_ACTIONITEM")
a.ObjectName = "new"
a.AdvancedLuaScript = "return inmation.getvalue('A')"
a.refs = { { name = 'A', path = inmation.slf():path() } }
a:commit()
return 'OK'

This will create an action item with a reference to self named A. The type, when not specified, defaults to "OBJECT_LINK" (triggering). Check the inmation.setreferences() function for a list of all the existing types. The following example shows how to modify existing references – delete all of them in this case – and also inspect what references are present:

local a = inmation.getobject("/System/localhost/new")
local old = a.refs
a.refs = {}
a:commit()
return old[1].path

When a refs field is set, as in the examples above, it must be set to a table; setting it to anything else, including nil, will make the object not-committable. The same applies to the content of refs table: it must only contain tables, and those in turn must contain at least the path field.

It is also possible not to set or reset the entire refs table as in the examples above, but manipulate individual entries directly, via a.refs[1] = … or via a.refs[1].path = …

sysname

obj:sysname()

Description

Returns the system name (e.g. "CO.1.13").

state

obj:state()

Description

Returns the Object State bitmask as an integer. See the ModObjectState flag group for more details.

textid

obj:textid()

Description

Returns the textual ID of the object (e.g. "1.7459.0").

type

obj:type()

Description

Determines the object’s class. It returns two values as follows: first is the string value of the type (e.g. "MODEL_CLASS_CORE") and the second is the numeric value of the type (e.g. 3 for a Core object).

Examples

obj = inmation.getobject("/System/localhost/object")
type_meaning, type_code = obj:type()