diff --git a/src/scriptInterface.h b/src/scriptInterface.h index 732097a..7026b07 100644 --- a/src/scriptInterface.h +++ b/src/scriptInterface.h @@ -160,6 +160,7 @@ class ScriptSimpleCallback if (lua_pcall(L, i, 1, 0)) { LOG(ERROR) << "Callback function error: " << lua_tostring(L, -1); + last_error = lua_tostring(L, -1); lua_pop(L, 2); if constexpr (std::is_void_v) return; @@ -232,6 +233,8 @@ class ScriptSimpleCallback //Return the script object linked to this callback, if any. P getScriptObject(); + + static inline string last_error; }; template<> void convert::param(lua_State* L, int& idx, ScriptSimpleCallback& callback);