mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-05 06:21:57 +00:00
## About The Pull Request Ever since byondapi went stable, I've been meaning to create a replacement lua library that uses it instead of the auxtools-based auxlua. After so many months, I've finally got the code just about into a position where it's ready for a PR. [Click here](https://hackmd.io/@aloZJicNQrmfYgykhfFwAQ/BySAS18u0) for a guide to rewriting auxlua scripts for dreamluau syntax. ## Why It's Good For The Game Code that runs on production servers should not depend on memory hacks that are liable to break any time Dream Daemon updates. ## Changelog 🆑 admin: Admin lua scripting uses a new library that (probably) will not break when BYOND updates. /🆑 ## TODO: - [x] Convert the lua editor ui to TS - [x] Include a guide for converting scripts from auxlua syntax to dreamluau syntax
49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
/proc/wrap_lua_get_var(datum/thing, var_name)
|
|
SHOULD_NOT_SLEEP(TRUE)
|
|
if(thing == world)
|
|
return world.vars[var_name]
|
|
if(ref(thing) == "\[0xe000001\]") //This weird fucking thing is like global.vars, but it's not a list and vars is not a valid index for it and I really don't fucking know.
|
|
return global.vars[var_name]
|
|
if(thing.can_vv_get(var_name))
|
|
return thing.vars[var_name]
|
|
|
|
/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)
|
|
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)
|
|
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", "message" = print_message)
|
|
INVOKE_ASYNC(target_state, TYPE_PROC_REF(/datum/lua_state, log_result), result, TRUE)
|
|
log_lua("[target_state]: [print_message]")
|