Skip to content

Commit 13453b4

Browse files
authored
Update 2024-02-29-creating-the-perfect-modding-language.md
1 parent c79da6d commit 13453b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_posts/2024-02-29-creating-the-perfect-modding-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ on_tick() {
145145
}
146146
```
147147

148-
Instead of having <span style="color:#C792EA">`hash_map_string`</span>, <span style="color:#C792EA">`hash_map_i32`</span>, <span style="color:#C792EA">`hash_map_f32`</span>, etc., the [grug mod loader for Minecraft](https://github.com/MyNameIsTrez/grug-mod-loader-for-minecraft) offers a generic <span style="color:#C792EA">`hash_map`</span> game function that only stores <span style="color:#FFC964">`id`</span>s. The way to store an <span style="color:#FFC964">`i32`</span> in it is inspired by [Java's autoboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html): you use the game function <span style="color:#C792EA">`box_i32`</span> to wrap an <span style="color:#FFC964">`i32`</span> in an object whose <span style="color:#FFC964">`id`</span> is returned, and you use <span style="color:#C792EA">`unbox_i32`</span> to get the <span style="color:#FFC964">`i32`</span> that is contained in the object back.
148+
Instead of having the game functions <span style="color:#C792EA">`hash_map_string`</span>, <span style="color:#C792EA">`hash_map_i32`</span>, <span style="color:#C792EA">`hash_map_f32`</span>, etc., the [grug mod loader for Minecraft](https://github.com/MyNameIsTrez/grug-mod-loader-for-minecraft) offers a generic <span style="color:#C792EA">`hash_map`</span> game function that only stores <span style="color:#FFC964">`id`</span>s. The way to store an <span style="color:#FFC964">`i32`</span> in it is inspired by [Java's autoboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html): you use the game function <span style="color:#C792EA">`box_i32`</span> to wrap an <span style="color:#FFC964">`i32`</span> in an object whose <span style="color:#FFC964">`id`</span> is returned, and you use <span style="color:#C792EA">`unbox_i32`</span> to get the <span style="color:#FFC964">`i32`</span> that is contained in the object back.
149149

150150
### grug is stupidly easy to set up
151151

0 commit comments

Comments
 (0)