Updated Introduction to Editor Scripting.md (markdown)
commited
commit
d730ecf54f41442edfa0d49ebb9b001cad8fdc70
... | ... | @@ -19,7 +19,7 @@ setBlock(0, 0, 0, 3); |
19 | 19 | ``` |
20 | 20 | Copy this code and paste it in the editor, then hit `Run` and `Save and Close`. As you might have guessed, this puts a block on the coordinates `(0, 0, 0)`. The fourth value is the unique identifier for the Grass block to be placed. There is a list of unique ids for each built-in block, but what if we want to place a custom block instead? |
21 | 21 | |
22 | ### Creating Functions |
|
22 | ## Creating Functions |
|
23 | 23 | We have already seen some built-in functions, but what if we wanted to create our own ones? |
24 | 24 | ```js |
25 | 25 | function moveBlock(fromX, fromY, fromZ, toX, toY, toZ) { |
... | ... | @@ -96,7 +96,7 @@ for (let index in myBlocks) { |
96 | 96 | ``` |
97 | 97 | This time, the line starts with a `for` loop expression. Inside this expression, we create a variable `index` and assign it to each index in the array. The code inside the curly braces will then be repeated for each new index. This is similar to using a [[Loop]] block with the array length as input. |
98 | 98 | |
99 | ## Objects |
|
99 | ## [๐](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#objects)Objects |
|
100 | 100 | ```js |
101 | 101 | // Create an empty object |
102 | 102 | let myBlocks = {}; |