summaryrefslogtreecommitdiff
path: root/indra/llcommon/lua_function.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/lua_function.h')
-rw-r--r--indra/llcommon/lua_function.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/indra/llcommon/lua_function.h b/indra/llcommon/lua_function.h
index e28656c03b..10c201c234 100644
--- a/indra/llcommon/lua_function.h
+++ b/indra/llcommon/lua_function.h
@@ -115,8 +115,11 @@ public:
void check_interrupts_counter();
private:
+ /*---------------------------- feature flag ----------------------------*/
+ bool mFeature{ false };
+ /*---------------------------- feature flag ----------------------------*/
script_finished_fn mCallback;
- lua_State* mState;
+ lua_State* mState{ nullptr };
std::string mError;
S32 mInterrupts{ 0 };
};
@@ -169,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:
@@ -348,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);
@@ -361,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);
@@ -386,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);