-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e885f01
commit 6d57843
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Object>` | ||
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. |