Have minetest.debug call tostring (#13004)

This commit is contained in:
Jude Melton-Houghton 2022-11-29 07:12:08 -05:00 committed by GitHub
parent 38169db765
commit aac1635bf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,20 +6,23 @@
-- --
-- Initialize some very basic things -- Initialize some very basic things
function core.debug(...) core.log(table.concat({...}, "\t")) end do
if core.print then local function concat_args(...)
local core_print = core.print
-- Override native print and use
-- terminal if that's turned on
function print(...)
local n, t = select("#", ...), {...} local n, t = select("#", ...), {...}
for i = 1, n do for i = 1, n do
t[i] = tostring(t[i]) t[i] = tostring(t[i])
end end
core_print(table.concat(t, "\t")) return table.concat(t, "\t")
end 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 core.print = nil -- don't pollute our namespace
end end
end
math.randomseed(os.time()) math.randomseed(os.time())
minetest = core minetest = core