mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
Have minetest.debug call tostring (#13004)
This commit is contained in:
parent
38169db765
commit
aac1635bf7
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user