mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-19 06:03:14 +00:00
* More lua harddel fixes (#77556) ## About The Pull Request Fixes some more lua harddel problems with lingering refs on the gc_guard variable. This variable has been changed to a list instead and will get cleared every time the SSlua subsystem fires so that lua instantiated objects that are not tracked by the subsystem will essentially delete themselves on the next tick, aka whenever the lua script sleeps. Also removed the unnecessary and not completely functional lua_reference_cleanup proc which wasn't even being called reliably because the signal handler was the datum itself. ## Why It's Good For The Game Fixes more harddel bugs, increases consistency. Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * More lua harddel fixes --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
/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
|
|
if(usr)
|
|
ret = WrapAdminProcCall(thing_to_call, proc_name, arguments)
|
|
else
|
|
ret = HandleUserlessProcCall("lua", thing_to_call, proc_name, arguments)
|
|
if(isdatum(ret))
|
|
SSlua.gc_guard += ret
|
|
return ret
|
|
|
|
/proc/wrap_lua_global_proc_call(proc_name, list/arguments)
|
|
SHOULD_NOT_SLEEP(TRUE)
|
|
if(!usr)
|
|
usr = GLOB.lua_usr
|
|
var/ret
|
|
if(usr)
|
|
ret = WrapAdminProcCall(GLOBAL_PROC, proc_name, arguments)
|
|
else
|
|
ret = HandleUserlessProcCall("lua", GLOBAL_PROC, proc_name, arguments)
|
|
if(isdatum(ret))
|
|
SSlua.gc_guard += ret
|
|
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)
|
|
target_state = state
|
|
break
|
|
if(!target_state)
|
|
return
|
|
var/print_message = jointext(arguments, "\t")
|
|
var/result = list("status" = "print", "param" = print_message)
|
|
INVOKE_ASYNC(target_state, TYPE_PROC_REF(/datum/lua_state, log_result), result, TRUE)
|
|
log_lua("[target_state]: [print_message]")
|