Skip to content

Commit e71db7d

Browse files
authored
feat!: Create 0.13.0.md and bump versions
1 parent f564116 commit e71db7d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

release-notes/0.13.0.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# 0.13.0 - new callback, and preserving script state on reloads
2+
3+
## `on_script_reloaded`
4+
Scripts can now subscribe to `on_script_reloaded` and `on_script_unloaded` in order to preserve state between reloads:
5+
6+
```lua
7+
function on_script_unloaded()
8+
print("Goodbye world")
9+
return "house key"
10+
end
11+
12+
function on_script_reloaded(value)
13+
if value then
14+
print("I'm back. Thanks for the keys!")
15+
else
16+
end
17+
```
18+
19+
`on_script_unloaded` will be called every time a script is about to be unloaded, giving it the opportunity to return an arbitrary `ScriptValue`, this value will then be passed in to the `on_script_reloaded`
20+
callback which can be used to re-initialize the script.
21+
22+
`on_script_reloaded` will be called after `on_script_loaded`.
23+
24+
## Better responses
25+
26+
script callback response events now contain the entity which triggered the response on them.

0 commit comments

Comments
 (0)