diff --git a/docs/en/voxel/objects.md b/docs/en/voxel/objects.md new file mode 100644 index 0000000..16f6715 --- /dev/null +++ b/docs/en/voxel/objects.md @@ -0,0 +1,32 @@ +# Objects +The **object** data type is for storing pairs of values. Object entries each consist of a key and their value, and both can be of any type. When something is used as a key, it will be locked and become immutable. + +Classes and class intances are also objects. + +Objects can be created in Voxel using the following syntax: + +```voxel +var item = "banana"; + +var object = { + "stringKey": 123, + propertyKey: 456, + 789: true, + data: null, + message: "hello", + fruit: item, + list: [3, 2, 1], + nested: {object: true} +}; +``` + +## Reference + +### `Object` +The object data type. + +#### `length: Number` +The number of key-value pair entries in the object. + +#### `prototypes: List` +A mutable list of prototypes that the object inherits. When a key is accessed on the object and the object does not have an entry with the same key, each inherited object in the object's prototypes list will be looked up to find the key, starting from the last prototype in the list. \ No newline at end of file