From 3f306a407c5efde4640aaee57acadd10ec84f329 Mon Sep 17 00:00:00 2001 From: DS Date: Thu, 24 Oct 2024 17:52:27 +0200 Subject: [PATCH] `core.after`: Improve documentation details about how `time` is handled (#15316) --- doc/lua_api.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/lua_api.md b/doc/lua_api.md index f886e1097..c4fba1aa4 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -6923,6 +6923,14 @@ Timing * Optional: Variable number of arguments that are passed to `func` * Jobs set for earlier times are executed earlier. If multiple jobs expire at exactly the same time, then they are executed in registration order. + * `time` is a lower bound. The job is executed in the first server-step that + started at least `time` seconds after the last time a server-step started, + measured with globalstep dtime. + * In particular this can result in relatively large delays if `time` is close + to the server-step dtime. For example, with a target server-step of 0.09 s, + `core.after(0.09, ...)` often waits two steps, resulting in a delay of about + 0.18 s. + * If `time` is `0`, the job is executed in the next step. * `job:cancel()` * Cancels the job function from being called