summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lua_function.cpp9
-rw-r--r--indra/llcommon/lua_function.h2
-rw-r--r--indra/newview/llfloaterluadebug.cpp12
-rw-r--r--indra/newview/llfloaterluadebug.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_lua_debug.xml9
5 files changed, 31 insertions, 2 deletions
diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp
index 17d81e8fc7..e9b4bf0b89 100644
--- a/indra/llcommon/lua_function.cpp
+++ b/indra/llcommon/lua_function.cpp
@@ -406,9 +406,14 @@ void lua_pushllsd(lua_State* L, const LLSD& data)
}
LuaState::LuaState(script_finished_fn cb):
- mCallback(cb),
- mState(luaL_newstate())
+ mCallback(cb)
{
+ initLuaState();
+}
+
+void LuaState::initLuaState()
+{
+ mState = luaL_newstate();
luaL_openlibs(mState);
LuaFunction::init(mState);
// Try to make print() write to our log.
diff --git a/indra/llcommon/lua_function.h b/indra/llcommon/lua_function.h
index f549137c3e..54db92f73e 100644
--- a/indra/llcommon/lua_function.h
+++ b/indra/llcommon/lua_function.h
@@ -78,6 +78,8 @@ public:
~LuaState();
+ void initLuaState();
+
bool checkLua(const std::string& desc, int r);
// expr() is for when we want to capture any results left on the stack
diff --git a/indra/newview/llfloaterluadebug.cpp b/indra/newview/llfloaterluadebug.cpp
index 7d56d8e618..2d9dc89340 100644
--- a/indra/newview/llfloaterluadebug.cpp
+++ b/indra/newview/llfloaterluadebug.cpp
@@ -27,6 +27,7 @@
#include "llfloaterluadebug.h"
+#include "llcheckboxctrl.h"
#include "lllineeditor.h"
#include "lltexteditor.h"
#include "llviewermenufile.h" // LLFilePickerReplyThread
@@ -79,6 +80,7 @@ void LLFloaterLUADebug::onExecuteClicked()
mResultOutput->setValue("");
std::string cmd = mLineInput->getText();
+ cleanLuaState();
LLLUAmanager::runScriptLine(mState, cmd, [this](int count, const LLSD& result)
{
completion(count, result);
@@ -109,6 +111,7 @@ void LLFloaterLUADebug::runSelectedScript(const std::vector<std::string> &filena
if (!filepath.empty())
{
mScriptPath->setText(filepath);
+ cleanLuaState();
LLLUAmanager::runScriptFile(mState, filepath, [this](int count, const LLSD& result)
{
completion(count, result);
@@ -140,3 +143,12 @@ void LLFloaterLUADebug::completion(int count, const LLSD& result)
sep = ", ";
}
}
+
+void LLFloaterLUADebug::cleanLuaState()
+{
+ if(getChild<LLCheckBoxCtrl>("clean_lua_state")->get())
+ {
+ //Reinit to clean lua_State
+ mState.initLuaState();
+ }
+}
diff --git a/indra/newview/llfloaterluadebug.h b/indra/newview/llfloaterluadebug.h
index 69b334ae2d..7418174570 100644
--- a/indra/newview/llfloaterluadebug.h
+++ b/indra/newview/llfloaterluadebug.h
@@ -58,6 +58,7 @@ class LLFloaterLUADebug :
private:
void completion(int count, const LLSD& result);
+ void cleanLuaState();
LLTempBoundListener mOutConnection;
diff --git a/indra/newview/skins/default/xui/en/floater_lua_debug.xml b/indra/newview/skins/default/xui/en/floater_lua_debug.xml
index f03739f7c2..a028a1802c 100644
--- a/indra/newview/skins/default/xui/en/floater_lua_debug.xml
+++ b/indra/newview/skins/default/xui/en/floater_lua_debug.xml
@@ -25,6 +25,15 @@
width="100">
LUA string:
</text>
+ <check_box
+ follows="left|bottom"
+ height="15"
+ label="Use clean lua_State"
+ layout="topleft"
+ top="10"
+ right ="-70"
+ name="clean_lua_state"
+ width="70"/>
<line_editor
border_style="line"
border_thickness="1"