mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
[MIRROR] bumps auxlua to 1.4.0 [MDB IGNORE] (#18255)
* bumps auxlua to 1.4.0 (#72108) ## About The Pull Request Mothblocks recently talked about wanting an auxlua function to check if the lua state was about to overrun its execution limit, and that was something I had been thinking about for a long time prior, but never bothered to actually implement until it was brought up. So I did just that. The documentation has also been updated to include a description of how the execution limit works and how to use the new function, `over_exec_time` ## Why It's Good For The Game Allows for lua loops of indeterminate length to do as much work as they reasonably can in a single tick without setting off the execution limiter and erroring out. ## Changelog 🆑 admin: Adds a new function for admin lua scripting, "over_exec_time", for checking if lua code is running close to the execution limit. Details are available in the lua editor's help menu. admin: The execution limit is described in detail in the lua editor's help menu. /🆑 Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * bumps auxlua to 1.4.0 Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
This commit is contained in:
@@ -105,6 +105,18 @@ A weak reference to DM's `usr`. As a rule of thumb, this is a reference to the m
|
||||
|
||||
---
|
||||
|
||||
## Execution Limit
|
||||
|
||||
In order to prevent freezing the server with infinite loops, auxlua enforces an execution limit, defaulting to 100ms. When a single lua state has been executing for longer than this limit, it will eventually stop and produce an error.
|
||||
|
||||
To avoid exceeding the execution limit, call `sleep()` or `coroutine.yield()` before the execution limit is reached.
|
||||
|
||||
### over_exec_usage(fraction = 0.95)
|
||||
|
||||
This function returns whether the current run of the Lua VM has executed for longer than the specified fraction of the execution limit. You can use this function to branch to a call to `sleep()` or `coroutine.yield()` to maximize the amount of work done in a single run of the Lua VM. If nil, `fraction` will default to 0.95, otherwise, it will be clamped to the range \[0, 1\].
|
||||
|
||||
---
|
||||
|
||||
## Task management
|
||||
The Lua Scripting subsystem manages the execution of tasks for each Lua state. A single fire of the subsystem behaves as follows:
|
||||
- All tasks that slept since the last fire are resumed in the order they slept.
|
||||
|
||||
Reference in New Issue
Block a user