diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-11-29 07:12:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 07:12:08 -0500 |
commit | aac1635bf7ab09700136a7194e8827898edbe54f (patch) | |
tree | 27325cef30e5ae7d4561b975a1db11543aa903c6 | |
parent | 38169db765f2553316ae3f1c0f40b0f7e9154b49 (diff) | |
download | minetest-aac1635bf7ab09700136a7194e8827898edbe54f.tar.xz |
Have minetest.debug call tostring (#13004)
-rw-r--r-- | builtin/init.lua | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/builtin/init.lua b/builtin/init.lua index 869136016..96e7a937c 100644 --- a/builtin/init.lua +++ b/builtin/init.lua @@ -6,19 +6,22 @@ -- -- 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(...) +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 |