Skip to content

Commit 0b30746

Browse files
committed
lib-lua: Mention the usage of dovecot.event() in script_init()
1 parent 392a01b commit 0b30746

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/core/admin/lua/lib_lua.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ When script is loaded, `script_init()` function is called, if found.
3030
if necessary.
3131
:::
3232

33+
To use an event in script_init(), use the dovecot.event() API call.
34+
This returns an event that uses the script event as its parent.
35+
36+
```lua
37+
function script_init()
38+
local event = dovecot.event()
39+
event:log_debug("log message")
40+
return 0
41+
end
42+
```
43+
3344
## De-initialization
3445

3546
When script is being unloaded, `script_deinit()` function is called, if found.

0 commit comments

Comments
 (0)