aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-08-25 12:54:16 +0200
committerKahrl <kahrl@gmx.net>2013-09-04 12:19:26 +0200
commit5b518ed2feff28c9bf21ad940c1b211b72d71bd1 (patch)
tree841cb84e0d347ab3dfc90027b5ef3e6ded5994d3
parentaf490330e7f76ba1916c99d90c705a09f68ac00a (diff)
downloadminetest-5b518ed2feff28c9bf21ad940c1b211b72d71bd1.tar.gz
minetest-5b518ed2feff28c9bf21ad940c1b211b72d71bd1.tar.bz2
minetest-5b518ed2feff28c9bf21ad940c1b211b72d71bd1.zip
Add backtrace to error function
-rw-r--r--builtin/builtin.lua6
-rw-r--r--builtin/mainmenu.lua6
2 files changed, 12 insertions, 0 deletions
diff --git a/builtin/builtin.lua b/builtin/builtin.lua
index 34477e6aa..99242f3d2 100644
--- a/builtin/builtin.lua
+++ b/builtin/builtin.lua
@@ -10,6 +10,12 @@ print = minetest.debug
math.randomseed(os.time())
os.setlocale("C", "numeric")
+local errorfct = error
+error = function(text)
+ print(debug.traceback(""))
+ errorfct(text)
+end
+
-- Load other files
local modpath = minetest.get_modpath("__builtin")
dofile(modpath.."/serialize.lua")
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua
index ab8dbe144..c5981caa6 100644
--- a/builtin/mainmenu.lua
+++ b/builtin/mainmenu.lua
@@ -2,6 +2,12 @@ print = engine.debug
math.randomseed(os.time())
os.setlocale("C", "numeric")
+local errorfct = error
+error = function(text)
+ print(debug.traceback(""))
+ errorfct(text)
+end
+
local scriptpath = engine.get_scriptdir()
mt_color_grey = "#AAAAAA"