summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-04-12 19:28:29 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-04-12 19:31:21 +0300
commit396ae60e1528515d0cbdfc4290b24ccb172998c8 (patch)
tree779f80cf4a91db7a43622a9a6d50edc66ce125a8 /indra/newview
parent5ce6c02ab3db983c7c876e5a41550bd94e53d0a7 (diff)
'Lua Scripts' floater clean up
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterluascripts.cpp16
-rw-r--r--indra/newview/llfloaterluascripts.h2
-rw-r--r--indra/newview/llluamanager.cpp8
3 files changed, 15 insertions, 11 deletions
diff --git a/indra/newview/llfloaterluascripts.cpp b/indra/newview/llfloaterluascripts.cpp
index 8f6ccc50fa..30353a7210 100644
--- a/indra/newview/llfloaterluascripts.cpp
+++ b/indra/newview/llfloaterluascripts.cpp
@@ -43,12 +43,20 @@ LLFloaterLUAScripts::LLFloaterLUAScripts(const LLSD &key)
{
mCommitCallbackRegistrar.add("Script.OpenFolder", [this](LLUICtrl*, const LLSD &userdata)
{
- gViewerWindow->getWindow()->openFolder(mTargetFolderPath);
+ if (mScriptList->hasSelectedItem())
+ {
+ std::string target_folder_path = std::filesystem::path((mScriptList->getFirstSelected()->getColumn(1)->getValue().asString())).parent_path().string();
+ gViewerWindow->getWindow()->openFolder(target_folder_path);
+ }
});
mCommitCallbackRegistrar.add("Script.Terminate", [this](LLUICtrl*, const LLSD &userdata)
{
- LLEventPumps::instance().obtain("LLLua").post(llsd::map("status", "close", "coro", mCoroName));
- LLLUAmanager::terminateScript(mCoroName);
+ if (mScriptList->hasSelectedItem())
+ {
+ std::string coro_name = mScriptList->getSelectedValue();
+ LLEventPumps::instance().obtain("LLLua").post(llsd::map("status", "close", "coro", coro_name));
+ LLLUAmanager::terminateScript(coro_name);
+ }
});
}
@@ -117,8 +125,6 @@ void LLFloaterLUAScripts::onScrollListRightClicked(LLUICtrl *ctrl, S32 x, S32 y)
auto menu = mContextMenuHandle.get();
if (menu)
{
- mTargetFolderPath = std::filesystem::path((item->getColumn(1)->getValue().asString())).parent_path().string();
- mCoroName = item->getValue().asString();
menu->show(x, y);
LLMenuGL::showPopup(this, menu, x, y);
}
diff --git a/indra/newview/llfloaterluascripts.h b/indra/newview/llfloaterluascripts.h
index c7c888b55a..932c5c78dd 100644
--- a/indra/newview/llfloaterluascripts.h
+++ b/indra/newview/llfloaterluascripts.h
@@ -46,8 +46,6 @@ private:
std::unique_ptr<LLTimer> mUpdateTimer;
LLScrollListCtrl* mScriptList;
- std::string mTargetFolderPath;
- std::string mCoroName;
LLHandle<LLContextMenu> mContextMenuHandle;
};
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp
index 344ab1bb99..853ed5a634 100644
--- a/indra/newview/llluamanager.cpp
+++ b/indra/newview/llluamanager.cpp
@@ -192,14 +192,14 @@ void LLLUAmanager::runScriptFile(const std::string &filename, script_result_fn r
lua_callbacks(L)->interrupt = [](lua_State *L, int gc)
{
+ // skip if we're interrupting only for garbage collection
if (gc >= 0)
return;
- std::set<std::string> scripts = LLLUAmanager::getTerminationList();
- std::string coro = LLCoros::getName();
- if (scripts.find(coro) != scripts.end())
+ auto it = sTerminationList.find(LLCoros::getName());
+ if (it != sTerminationList.end())
{
- sTerminationList.erase(coro);
+ sTerminationList.erase(it);
lluau::error(L, "Script was terminated");
}
};