diff --git a/doc/20-language-reference.md b/doc/20-language-reference.md index ce9e2c3bd..f8aa50e9c 100644 --- a/doc/20-language-reference.md +++ b/doc/20-language-reference.md @@ -805,7 +805,8 @@ Array | [ "a", "b" ] | An array. Dictionary | { a = 3 } | A dictionary. Depending on which libraries are loaded additional types may become available. The `icinga` -library implements a whole bunch of other types, e.g. Host, Service, CheckCommand, etc. +library implements a whole bunch of other [object types](6-object-types.md#object-types), +e.g. Host, Service, CheckCommand, etc. Each type has an associated type object which describes the type's semantics. These type objects are made available using global variables which match the type's name: @@ -816,9 +817,12 @@ type objects are made available using global variables which match the type's na The type object's `prototype` property can be used to find out which methods a certain type supports: - /* This returns: ["find","len","lower","replace","split","substr","to_string","upper"] */ + /* This returns: ["contains","find","len","lower","replace","reverse","split","substr","to_string","upper"] */ keys(String.prototype) +Additional documentation on type methods is available in the +[library reference](21-library-reference.md#library-reference). + ## Reserved Keywords These keywords are reserved and must not be used as constants or custom attributes. diff --git a/doc/21-library-reference.md b/doc/21-library-reference.md index 48f8f5314..727a9625d 100644 --- a/doc/21-library-reference.md +++ b/doc/21-library-reference.md @@ -508,8 +508,22 @@ Signature: Returns a copy of the string in reverse order. +## Object type + +### Object#clone + +Signature: + + function clone(); + +Returns a copy of the object. Note that for object elements which are +reference values (e.g. objects such as arrays or dictionaries) the entire +object is recursively copied. + ## Array type +Inherits methods from the [object type](21-library-reference.md#object-type). + ### Array#add Signature: @@ -600,6 +614,10 @@ Signature: Returns a new array with all elements of the current array in reverse order. +## Dictionary type + +Inherits methods from the [object type](21-library-reference.md#object-type). + ### Dictionary#shallow_clone Signature: