Exit on Ctrl-C in console without crashing (nw)

This commit is contained in:
Miodrag Milanovic 2016-11-07 09:17:46 +01:00
parent f3723e3a5d
commit f9a5b51768

View File

@ -820,8 +820,13 @@ void lua_engine::initialize()
thstate["status"] = ctx.result;
};
auto ret = func();
if(ret.valid())
ctx.result = ret.get<const char *>();
if (ret.valid()) {
const char *tmp = ret.get<const char *>();
if (tmp != nullptr)
ctx.result = tmp;
else
exit(0);
}
}
ctx.busy = false;
});