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.
This commit is contained in:
Y0SH1M4S73R
2022-07-31 10:09:01 +03:00
committed by GitHub
parent 18ce9e2460
commit e72ec7445a
6 changed files with 90 additions and 45 deletions
+5 -1
View File
@@ -1,7 +1,9 @@
/proc/wrap_lua_set_var(datum/thing_to_set, var_name, value)
SHOULD_NOT_SLEEP(TRUE)
thing_to_set.vv_edit_var(var_name, value)
/proc/wrap_lua_datum_proc_call(datum/thing_to_call, proc_name, list/arguments)
SHOULD_NOT_SLEEP(TRUE)
if(!usr)
usr = GLOB.lua_usr
var/ret
@@ -16,6 +18,7 @@
return ret
/proc/wrap_lua_global_proc_call(proc_name, list/arguments)
SHOULD_NOT_SLEEP(TRUE)
if(!usr)
usr = GLOB.lua_usr
var/ret
@@ -30,6 +33,7 @@
return ret
/proc/wrap_lua_print(state_id, list/arguments)
SHOULD_NOT_SLEEP(TRUE)
var/datum/lua_state/target_state
for(var/datum/lua_state/state as anything in SSlua.states)
if(state.internal_id == state_id)
@@ -39,5 +43,5 @@
return
var/print_message = jointext(arguments, "\t")
var/result = list("status" = "print", "param" = print_message)
target_state.log_result(result, verbose = TRUE)
INVOKE_ASYNC(target_state, /datum/lua_state.proc/log_result, result, TRUE)
log_lua("[target_state]: [print_message]")