Files
Bubberstation/code/modules/admin/verbs/lua/helpers.dm
SkyratBot 9c33d03245 [MIRROR] [Lua] You can now await expensive non-sleeping procs. [MDB IGNORE] (#15962)
* [Lua] You can now `await` expensive non-sleeping procs. (#69570)

When trying to run getFlatIcon using lua scripting, I discovered that it was so expensive that, for certain atoms like complex humans, there is no way it will complete within the lua execution limit. While Mothblocks would suggest just raising the execution limit, the idea leaves a bad taste in my mouth due to the possibility of a script causing extreme lag by consistently overrunning the BYOND tick.

I instead elected to make /datum/auxtools_promise sleep once before invoking its assigned proc, thus immediately returning execution to lua, even if the proc being awaited wouldn't sleep. This allows for awaiting extremely expensive non-sleeping procs (like the aforementioned getFlatIcon)

* [Lua] You can now `await` expensive non-sleeping procs.

Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
2022-09-02 19:49:54 -04:00

1.6 KiB