Skip to content

Commit d058ece

Browse files
authored
docs: update callback doc
1 parent 8aa4263 commit d058ece

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/src/ScriptingReference/core-callbacks.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The two core callbacks are:
1010

1111
This will be called right after a script has been loaded or reloaded. This is a good place to initialize your script. You should avoid placing a lot of logic into the global body of your script, and instead put it into this callback. Otherwise errors in the initialization will fail the loading of the script.
1212

13+
This callback will not have access to the `entity` variable, as when the script is being loaded it's not attached to an entity yet.
14+
1315
```lua
1416
print("you can also use this space, but it's not recommended")
1517
function on_script_loaded()
@@ -21,8 +23,10 @@ end
2123

2224
This will be called right before a script is unloaded. This is a good place to clean up any resources that your script has allocated. Note this is not called when a script is reloaded, only when it is being removed from the system.
2325

26+
This callback will not have access to the `entity` variable, as when the script is being unloaded it might not be attached to an entity.
27+
2428
```lua
2529
function on_script_unloaded()
2630
print("Goodbye world")
2731
end
28-
```
32+
```

0 commit comments

Comments
 (0)