[MIRROR] Fixes a lua state null return related to the print wrapper, improves the lua editor ui formatting, and implements a stopgap lua lag fix [MDB IGNORE] (#15320)

* Fixes a lua state null return related to the print wrapper, improves the lua editor ui formatting, and implements a stopgap lua lag fix (#68816)

This PR fixes this issue by making sure every proc called in the stack of /proc/wrap_lua_print which could sleep is called using INVOKE_ASYNC, and to prevent such problems in the future, marks all the wrappers as SHOULD_NOT_SLEEP(TRUE). I also figured out how to fix the dumb overflowing problem of the lua editor ui.

Due to lag concerns regarding lua states with a large number of global variables (including fields within global tables), I have made it so the global table and state log are hidden by default - they can be shown using a toggle button in the editor ui.

* Fixes a lua state null return related to the print wrapper, improves the lua editor ui formatting, and implements a stopgap lua lag fix

Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
This commit is contained in:
SkyratBot
2022-07-31 17:43:52 +02:00
committed by GitHub
parent 74ae18fd7e
commit 6503f2c596
6 changed files with 90 additions and 45 deletions

View File

@@ -7,6 +7,9 @@
/// Arguments for a function call or coroutine resume
var/list/arguments = list()
/// If set, the global table and the
var/show_debug_info = FALSE
/datum/lua_editor/New(state, _quick_log_index)
. = ..()
if(state)
@@ -36,12 +39,13 @@
/datum/lua_editor/ui_data(mob/user)
var/list/data = list()
data["noStateYet"] = !current_state
data["showDebugInfo"] = show_debug_info
if(current_state)
current_state.get_globals()
if(current_state.log)
if(current_state.log && show_debug_info)
data["stateLog"] = kvpify_list(refify_list(current_state.log))
data["tasks"] = current_state.get_tasks()
if(current_state.globals)
if(show_debug_info)
current_state.get_globals()
data["globals"] = kvpify_list(refify_list(current_state.globals))
data["states"] = SSlua.states
data["callArguments"] = kvpify_list(refify_list(arguments))
@@ -187,6 +191,9 @@
if("clearArgs")
arguments.Cut()
return TRUE
if("toggleShowDebugInfo")
show_debug_info = !show_debug_info
return TRUE
/datum/lua_editor/ui_close(mob/user)
. = ..()