From cf138b33a703610c67b34afaf38c6b9dc3746ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Sat, 19 Mar 2022 15:47:40 +0100 Subject: [PATCH] Fix note on `minetest.after` callback exec order --- doc/timing.adoc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/doc/timing.adoc b/doc/timing.adoc index 46edd53..5c1c550 100644 --- a/doc/timing.adoc +++ b/doc/timing.adoc @@ -190,18 +190,7 @@ Will call `func(...)` after at least `time` seconds have passed. TIP: Use `minetest.after(0, func)` to immediately do load-time stuff that is only possible at run-time, or to schedule something for the next server step. -[NOTE] -.Order of execution -==== -Scheduled calls happen in reverse insertion order. This "defers" calls to `minetest.after` from within a callback until the next server step. Examples: - -[source,lua] ----- -minetest.after(0, error, "first") -minetest.after(0, error, "second") ----- -This script will error with `second` after the first server step, -as the callbacks that are scheduled to run in the same server step are processed in reverse order. +CAUTION: Scheduled calls that run in the same server step are executed in no particular order. The following snippet emulates a globalstep, sending `Hello World!` to chat every server step: [source,lua]