OpenSCAD User Manual/Objects
part of the section on Values, Data Types, and Constants
Objects
[Note: Requires version Development snapshot (see [snapshot Release Notes ] )]
Objects store collections of data, like vectors, but the individual members are accessed by string names rather than by numeric indexes. They are analogous to JavaScript objects or Python dictionaries. There is currently a limited implementation of objects: it is not possible for an OpenSCAD program to create an object, only to receive one as the return value from a function.
Retrieving a value from an object
obj.name
Retrieves the named value from the object, for a name that is constant and syntactically suitable for use as an identifier.
obj["name"]
Retrieves the named value from the object, for a name that is an arbitrary string expression.
Note that members with identifier-like names can be accessed using either mechanism. The choice depends on the particular use case.
Iterating over object members
for (name = obj) { ... }
iterates over the members of the object, in an unspecified order, setting name to the name of each member. It is then typically desirable to access the value using obj[name].
This construct works for flow-control for, intersection_for(), and list-comprehension for.