diff options
| author | Rogier <rogier777@gmail.com> | 2016-07-25 18:43:15 +0200 |
|---|---|---|
| committer | paramat <mat.gregory@virginmedia.com> | 2016-12-24 00:18:45 +0000 |
| commit | a76e7698b21d51594d82e329d3825ee86e653295 (patch) | |
| tree | a82a2002962ccac1aa01af6257d57d0c4bb973ad /src/script | |
| parent | a95f983ea8665bfd14289b142cef1185838cc531 (diff) | |
Make minetest abort on lua panic
Currently, lua does a regular exit() after a lua panic, which can make
a problem hard to debug. Invoking FATAL_ERROR() instead will print
some useful information, and abort() minetest, so that a debugger can
be used to analyze the situation.
Diffstat (limited to 'src/script')
| -rw-r--r-- | src/script/cpp_api/s_base.cpp | 13 | ||||
| -rw-r--r-- | src/script/cpp_api/s_base.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index 679a517ee..cbe5735a7 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -40,6 +40,7 @@ extern "C" { #include <stdio.h> #include <cstdarg> +#include <sstream> class ModNameStorer @@ -77,6 +78,8 @@ ScriptApiBase::ScriptApiBase() : m_luastack = luaL_newstate(); FATAL_ERROR_IF(!m_luastac/*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public Li const std::string &mod_name) { diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h index f52474f00..c27235255 100644 --- a/src/script/cpp_api/s_base.h +++ b/src/script/cpp_api/s_base.h @@ -118,6 +118,8 @@ protected: #endif private: + static int luaPanic(lua_State *L); + lua_State* m_luastack; Server* m_server; |
