summaryrefslogtreecommitdiff
path: root/indra/llcommon/lua_function.h
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-13 09:20:57 -0400
committerGitHub <noreply@github.com>2024-09-13 09:20:57 -0400
commit7ced89435d702b8a6bc02908769bed47e20d6ec0 (patch)
treebb4735ba807f4d4caf7cf6161462557cfc9864bd /indra/llcommon/lua_function.h
parent3d191c09b1b1eb6726fe67f6fdf5445d83536578 (diff)
parentd6f3f20af6cccf53746cbf1fdf39bc4e235c4f0d (diff)
Merge pull request #2548 from secondlife/lua-frame-profile
Make Develop->Render Tests->Frame Profile dump JSON to a file too (#2412)
Diffstat (limited to 'indra/llcommon/lua_function.h')
-rw-r--r--indra/llcommon/lua_function.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/indra/llcommon/lua_function.h b/indra/llcommon/lua_function.h
index 967d8eaba1..10c201c234 100644
--- a/indra/llcommon/lua_function.h
+++ b/indra/llcommon/lua_function.h
@@ -172,7 +172,10 @@ public:
LuaRemover& operator=(const LuaRemover&) = delete;
~LuaRemover()
{
- lua_remove(mState, mIndex);
+ // If we're unwinding the C++ stack due to an exception, don't mess
+ // with the Lua stack!
+ if (std::uncaught_exceptions() == 0)
+ lua_remove(mState, mIndex);
}
private:
@@ -351,7 +354,7 @@ auto lua_setfieldv(lua_State* L, int index, const char* k, const T& value)
// return to C++, from table at index, the value of field k (without metamethods)
template <typename T>
-auto lua_rawgetfield(lua_State* L, int index, const std::string_view& k)
+auto lua_rawgetfield(lua_State* L, int index, std::string_view k)
{
index = lua_absindex(L, index);
lua_checkdelta(L);
@@ -364,7 +367,7 @@ auto lua_rawgetfield(lua_State* L, int index, const std::string_view& k)
// set in table at index, as field k, the specified C++ value (without metamethods)
template <typename T>
-void lua_rawsetfield(lua_State* L, int index, const std::string_view& k, const T& value)
+void lua_rawsetfield(lua_State* L, int index, std::string_view k, const T& value)
{
index = lua_absindex(L, index);
lua_checkdelta(L);
@@ -389,8 +392,8 @@ void lua_rawsetfield(lua_State* L, int index, const std::string_view& k, const T
class LuaFunction
{
public:
- LuaFunction(const std::string_view& name, lua_CFunction function,
- const std::string_view& helptext);
+ LuaFunction(std::string_view name, lua_CFunction function,
+ std::string_view helptext);
static void init(lua_State* L);