From 2d50935079c454964305c0af879aba4a77474400 Mon Sep 17 00:00:00 2001 From: bangonicdd <157843588+bangonicdd2@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:09:02 +0900 Subject: [PATCH] fix: makes more concise by removing one-used var --- src/ts/process/lua.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ts/process/lua.ts b/src/ts/process/lua.ts index 91359d42..727cfb59 100644 --- a/src/ts/process/lua.ts +++ b/src/ts/process/lua.ts @@ -23,7 +23,6 @@ interface LuaEngineState { code?: string; engine?: LuaEngine; mutex: Mutex; - wasEmpty?: boolean; chat?: Chat; setVar?: (key:string, value:string) => void, getVar?: (key:string) => string, @@ -59,11 +58,8 @@ export async function runLua(code:string, arg:{ luaEngineState.setVar = setVar luaEngineState.getVar = getVar if (code !== luaEngineState.code) { - if (!luaEngineState.wasEmpty){ - luaEngineState.engine.global.close() - } + luaEngineState.engine?.global.close() luaEngineState.code = code - luaEngineState.wasEmpty = false luaEngineState.engine = await luaFactory.createEngine({injectObjects: true}) const luaEngine = luaEngineState.engine luaEngine.global.set('setChatVar', (id:string,key:string, value:string) => { @@ -605,7 +601,6 @@ async function getOrCreateEngineState( const creationPromise = (async () => { const engineState: LuaEngineState = { mutex: new Mutex(), - wasEmpty: true, }; LuaEngines.set(mode, engineState);