From 8f9acfd71f7cc2b6295404c8fb270bb4b83f5626 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 9 Feb 2024 11:32:02 -0500 Subject: Make LLFloaterLUADebug store a persistent LuaState. That means that as you use the floater, variables that you assign and functions that you define are available to subsequent Lua chunks. --- indra/newview/llfloaterluadebug.cpp | 4 ++-- indra/newview/llfloaterluadebug.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterluadebug.cpp b/indra/newview/llfloaterluadebug.cpp index b2c001817f..d7b46eaa71 100644 --- a/indra/newview/llfloaterluadebug.cpp +++ b/indra/newview/llfloaterluadebug.cpp @@ -77,7 +77,7 @@ void LLFloaterLUADebug::onExecuteClicked() mResultOutput->setValue(""); std::string cmd = mLineInput->getText(); - LLLUAmanager::runScriptLine(cmd, [this](int count, const LLSD& result) + LLLUAmanager::runScriptLine(mState, cmd, [this](int count, const LLSD& result) { completion(count, result); }); @@ -107,7 +107,7 @@ void LLFloaterLUADebug::runSelectedScript(const std::vector &filena if (!filepath.empty()) { mScriptPath->setText(filepath); - LLLUAmanager::runScriptFile(filepath, [this](int count, const LLSD& result) + LLLUAmanager::runScriptFile(mState, filepath, [this](int count, const LLSD& result) { completion(count, result); }); diff --git a/indra/newview/llfloaterluadebug.h b/indra/newview/llfloaterluadebug.h index 2dc59c5894..69b334ae2d 100644 --- a/indra/newview/llfloaterluadebug.h +++ b/indra/newview/llfloaterluadebug.h @@ -28,6 +28,7 @@ #include "llevents.h" #include "llfloater.h" +#include "lua_function.h" extern "C" { @@ -63,6 +64,7 @@ private: LLTextEditor* mResultOutput; LLLineEditor* mLineInput; LLLineEditor* mScriptPath; + LuaState mState; }; #endif // LL_LLFLOATERLUADEBUG_H -- cgit v1.2.3