mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 18:09:41 +00:00
Merge branch 'solve_6430' into 'master'
Use a setting to enable Lua Action tracebacks See merge request OpenMW/openmw!1419
This commit is contained in:
commit
6f5e0e7697
4 changed files with 27 additions and 13 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/lua/luastate.hpp>
|
#include <components/lua/luastate.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -12,12 +13,12 @@
|
||||||
|
|
||||||
namespace MWLua
|
namespace MWLua
|
||||||
{
|
{
|
||||||
|
Action::Action(LuaUtil::LuaState* state)
|
||||||
#ifdef NDEBUG
|
{
|
||||||
Action::Action(LuaUtil::LuaState* state) {}
|
static const bool luaDebug = Settings::Manager::getBool("lua debug", "Lua");
|
||||||
#else
|
if (luaDebug)
|
||||||
Action::Action(LuaUtil::LuaState* state) : mCallerTraceback(state->debugTraceback()) {}
|
mCallerTraceback = state->debugTraceback();
|
||||||
#endif
|
}
|
||||||
|
|
||||||
void Action::safeApply(WorldView& w) const
|
void Action::safeApply(WorldView& w) const
|
||||||
{
|
{
|
||||||
|
@ -28,11 +29,11 @@ namespace MWLua
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Error in " << this->toString() << ": " << e.what();
|
Log(Debug::Error) << "Error in " << this->toString() << ": " << e.what();
|
||||||
#ifdef NDEBUG
|
|
||||||
Log(Debug::Error) << "Traceback is available only in debug builds";
|
if (mCallerTraceback.empty())
|
||||||
#else
|
Log(Debug::Error) << "Set 'lua_debug=true' in settings.cfg to enable action tracebacks";
|
||||||
Log(Debug::Error) << "Caller " << mCallerTraceback;
|
else
|
||||||
#endif
|
Log(Debug::Error) << "Caller " << mCallerTraceback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,7 @@ namespace MWLua
|
||||||
virtual std::string toString() const = 0;
|
virtual std::string toString() const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef NDEBUG
|
|
||||||
std::string mCallerTraceback;
|
std::string mCallerTraceback;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TeleportAction final : public Action
|
class TeleportAction final : public Action
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
Lua Settings
|
Lua Settings
|
||||||
############
|
############
|
||||||
|
|
||||||
|
lua debug
|
||||||
|
---------
|
||||||
|
|
||||||
|
:Type: boolean
|
||||||
|
:Range: True/False
|
||||||
|
:Default: False
|
||||||
|
|
||||||
|
Enables debug tracebacks for Lua actions.
|
||||||
|
It adds significant performance overhead, don't enable if you don't need it.
|
||||||
|
|
||||||
|
This setting can only be configured by editing the settings configuration file.
|
||||||
|
|
||||||
lua num threads
|
lua num threads
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
|
@ -1106,6 +1106,9 @@ stomp intensity = 1
|
||||||
|
|
||||||
[Lua]
|
[Lua]
|
||||||
|
|
||||||
|
# Enable performance-heavy debug features
|
||||||
|
lua debug = false
|
||||||
|
|
||||||
# Set the maximum number of threads used for Lua scripts.
|
# Set the maximum number of threads used for Lua scripts.
|
||||||
# If zero, Lua scripts are processed in the main thread.
|
# If zero, Lua scripts are processed in the main thread.
|
||||||
lua num threads = 1
|
lua num threads = 1
|
||||||
|
|
Loading…
Reference in a new issue