]> git.lizzy.rs Git - minetest.git/blobdiff - builtin/init.lua
Add minetest.get_player_window_information() (#12367)
[minetest.git] / builtin / init.lua
index 8691360169379bc82ede6e9892a41442fea6a3b8..e03c2c6deb379aaa3b200d5e440811f520bce621 100644 (file)
@@ -6,19 +6,25 @@
 --
 
 -- Initialize some very basic things
-function core.debug(...) core.log(table.concat({...}, "\t")) end
-if core.print then
-       local core_print = core.print
-       -- Override native print and use
-       -- terminal if that's turned on
-       function print(...)
+function core.error_handler(err, level)
+       return debug.traceback(tostring(err), level)
+end
+do
+       local function concat_args(...)
                local n, t = select("#", ...), {...}
                for i = 1, n do
                        t[i] = tostring(t[i])
                end
-               core_print(table.concat(t, "\t"))
+               return table.concat(t, "\t")
+       end
+       function core.debug(...) core.log(concat_args(...)) end
+       if core.print then
+               local core_print = core.print
+               -- Override native print and use
+               -- terminal if that's turned on
+               function print(...) core_print(concat_args(...)) end
+               core.print = nil -- don't pollute our namespace
        end
-       core.print = nil -- don't pollute our namespace
 end
 math.randomseed(os.time())
 minetest = core