Skip to content

Commit 41f79e9

Browse files
authored
Update 2024-02-29-creating-the-perfect-modding-language.md
1 parent 15d8910 commit 41f79e9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ So a modder might call `vector_string_create()`, which returns an <span style="c
120120

121121
The game developer *could* add a `vector_string_free(id)` function, but this is discouraged, as modders shouldn't be burdened with and counted on calling this function. grug might smell like C, but its goal is to be friendlier to newcomers.
122122

123-
Instead, the game should track which allocations have been made at the start of every <span style="color:#C3E88D">`on`</span> function call, as that allows the game to automatically free all of those allocations immediately after the <span style="color:#C3E88D">`on`</span> function call. Similarly, the game should track which global allocations each entity has made, so they can all be freed once the entity is despawned.
123+
Instead, the game should track which local allocations have been made at the start of every <span style="color:#C3E88D">`on`</span> function call, as that allows the game to automatically free all of those allocations immediately after the <span style="color:#C3E88D">`on`</span> function call. Similarly, the game should track which global allocations each entity has made, so they can all be freed once the entity is despawned.
124124

125125
What enables this clear separation between global and local allocated game memory, is the fact that grug throws a compilation error when you reassign a global <span style="color:#FFC964">`id`</span> inside of an <span style="color:#C3E88D">`on`</span> or <span style="color:#82AAFF">`helper`</span> function:
126126

0 commit comments

Comments
 (0)