diff --git a/code/__HELPERS/_dreamluau.dm b/code/__HELPERS/_dreamluau.dm index 196774d6a88..1e1e315a2ae 100644 --- a/code/__HELPERS/_dreamluau.dm +++ b/code/__HELPERS/_dreamluau.dm @@ -1,8 +1,12 @@ /* This comment bypasses grep checks */ /var/__dreamluau -#define DREAMLUAU (world.system_type == MS_WINDOWS ? "dreamluau.dll" : (__dreamluau || (__dreamluau = __detect_auxtools("dreamluau")))) +/* This comment also bypasses grep checks */ /var/__dreamluau_exists -#define DREAMLUAU_CALL(func) call_ext(DREAMLUAU, "byond:[#func]") +#define DREAMLUAU_EXISTS (__dreamluau_exists ||= fexists(DREAMLUAU)) + +#define DREAMLUAU (world.system_type == MS_WINDOWS ? "dreamluau.dll" : (__dreamluau ||= __detect_auxtools("dreamluau"))) + +#define DREAMLUAU_CALL(func) (!DREAMLUAU_EXISTS) ? null : call_ext(DREAMLUAU, "byond:[#func]") /** * All of the following functions will return a string if the underlying rust code returns an error or a wrapped panic. diff --git a/code/modules/admin/verbs/lua/lua_state.dm b/code/modules/admin/verbs/lua/lua_state.dm index 577b0e365c2..30bc21c83b2 100644 --- a/code/modules/admin/verbs/lua/lua_state.dm +++ b/code/modules/admin/verbs/lua/lua_state.dm @@ -41,7 +41,10 @@ GLOBAL_PROTECT(lua_state_stack) return display_name = _name internal_id = DREAMLUAU_NEW_STATE() - if(!isnum(internal_id)) + if(isnull(internal_id)) + stack_trace("dreamluau is not loaded") + qdel(src) + else if(!isnum(internal_id)) stack_trace(internal_id) qdel(src)