Make Lua hook timeout configurable
This commit is contained in:
parent
b89d29b744
commit
e635a45251
@ -259,7 +259,7 @@ int luacon_elementwrite(lua_State* l)
|
||||
void luacon_hook(lua_State * l, lua_Debug * ar)
|
||||
{
|
||||
auto *luacon_ci = static_cast<LuaScriptInterface *>(commandInterface);
|
||||
if (ar->event == LUA_HOOKCOUNT && Platform::GetTime() - luacon_ci->luaExecutionStart > 3000)
|
||||
if (ar->event == LUA_HOOKCOUNT && int(Platform::GetTime() - luacon_ci->luaExecutionStart) > luacon_ci->luaHookTimeout)
|
||||
{
|
||||
luaL_error(l, "Error: Script not responding");
|
||||
luacon_ci->luaExecutionStart = Platform::GetTime();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "bzip2/bz2wrap.h"
|
||||
#include "common/VariantIndex.h"
|
||||
#include "Config.h"
|
||||
#include "prefs/GlobalPrefs.h"
|
||||
|
||||
#include "LuaScriptInterface.h"
|
||||
|
||||
@ -272,6 +273,8 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
||||
currentCommand(false),
|
||||
textInputRefcount(0)
|
||||
{
|
||||
auto &prefs = GlobalPrefs::Ref();
|
||||
luaHookTimeout = prefs.Get("LuaHookTimeout", 3000);
|
||||
luacon_model = m;
|
||||
luacon_controller = c;
|
||||
luacon_sim = m->GetSimulation();
|
||||
|
@ -212,6 +212,7 @@ public:
|
||||
static void LuaSetProperty(lua_State* l, StructProperty property, intptr_t propertyAddress, int stackPos);
|
||||
static void LuaSetParticleProperty(lua_State* l, int particleID, StructProperty property, intptr_t propertyAddress, int stackPos);
|
||||
|
||||
int luaHookTimeout;
|
||||
ui::Window * Window;
|
||||
lua_State *l;
|
||||
long unsigned int luaExecutionStart = 0;
|
||||
|
Reference in New Issue
Block a user