Skip to content

Commit 32c7062

Browse files
authored
Update 2024-02-29-creating-the-perfect-modding-language.md
1 parent 4b4dceb commit 32c7062

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 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. You store an <span style="color:#FFC964">`i32`</span> in it by using the game function <span style="color:#C792EA">`box_i32`</span>, which wraps an <span style="color:#FFC964">`i32`</span> in an object, and returns its <span style="color:#FFC964">`id`</span>. You unwrap the <span style="color:#FFC964">`i32`</span> in it using <span style="color:#C792EA">`unbox_i32`</span>. This is similar to [Java's autoboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html).
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. You store an <span style="color:#FFC964">`i32`</span> in it by using the game function <span style="color:#C792EA">`box_i32`</span>, which wraps an <span style="color:#FFC964">`i32`</span> in an object, and returns its <span style="color:#FFC964">`id`</span>. You unwrap the <span style="color:#FFC964">`i32`</span> in it using <span style="color:#C792EA">`unbox_i32`</span>. This was inspired by [Java's autoboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html).
149149

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

0 commit comments

Comments
 (0)