Skip to content

Commit ca64769

Browse files
committed
Fix REPL print to stringify all arguments
1 parent 8e4d581 commit ca64769

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

addons/lua-gdextension/lua_repl.gd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ func reset():
3939
_lua = LuaState.new()
4040
_lua.open_libraries()
4141
_lua.registry.print = _printn
42-
_lua.do_string(r"print = function(...) debug.getregistry().print(table.concat({...}, '\t')) end")
42+
_lua.load_string(r"""
43+
local tab_size = ...
44+
local indent = string.rep(' ', tab_size)
45+
print = function(...)
46+
local args = {...}
47+
for i = 1, #args do
48+
args[i] = tostring(args[i])
49+
end
50+
debug.getregistry().print(table.concat(args, indent))
51+
end
52+
""").invoke(_output.tab_size)
4353

4454
_history.clear()
4555
_current_history = 0

0 commit comments

Comments
 (0)