ObjectsAn object is a sequence of fields with an associated value and name. Each object belongs to a class. Each object field has an index (starting from 0) giving the position in the sequence. It has a value which can be of any heitml data type. Fields can have a name, a case insensitive string. The number of fields, their names and types can change dynamically. An object can be used as a structure or record by accessing fields using the name. It can also be used as an array by indexing fields and as an associative array by using dynamic field names. CreationAn object is created by using the emptytuple magic variable, the array() functions, or a constructor. Emptytuple creates a new object without fields that belongs to the class Object. Array creates an Object with n unnamed fields containing the null value also belonging to the Object class. OperatorsThe operator . selects a field of an object.
The operator [ ] can be used to index an object.
Example:
Note that field names can be arbitrary strings, but the t.id syntax requires the field name to be an identifier. Using t["str"] instead arbitrary names can be used. Field names are always case insensitive. Reference SemanticsTuples have reference (also called pointer) semantics, as usual in object oriented languages. Assigning an object in fact assigns a reference to this object. The copy() function can be used to actually copy an object (deep copy). The TuAssign() can be used to copy all fields of an object (shallow copy). Example:
Field Handling FunctionsUsing the isdecl(), isnull(), isempty(), and default() functions the presents of a field can be checked. The function fname() returns the name of a specified field and findex() the index of the field. TuName() changes the name of a field and TuAssField() sets value and name. TuAppField() appends a field after a given field and TuInsField() before it. TuDelField() removes a field from an object. Object Field FunctionsTuAssign() assigns all fields of a given object to another object, TuMerge() merges two objects, TuProject() and TuSlice() get a group of fields from an object. ArAppend() and ArConcat() can be used to append fields or complete objects to a given object. These functions clear field names and so are useful for array operations. resize() can be used to change the size of an array. ArSearch() searches for a certain field content and TuFieldSort() sorts the fields of an object. Selected blog articles : 3D Objects on HTML pages, CSS Transition Visibility, and CSS Transition Display. © 1996-2025 H.E.I. All Rights Reserved. |
![]() |