# HG changeset patch # User jbe # Date 1427369160 -3600 # Node ID e00d11c12b689e665bb857a2aaea60a897689177 # Parent 8cf6d927d07447c082a3290450503e8e01ee09ec trace.debug(...) now handles nil values properly diff -r 8cf6d927d074 -r e00d11c12b68 framework/env/trace/debug.lua --- a/framework/env/trace/debug.lua Thu Mar 26 12:25:19 2015 +0100 +++ b/framework/env/trace/debug.lua Thu Mar 26 12:26:00 2015 +0100 @@ -1,19 +1,21 @@ --[[-- -trace.debug(...) - ... -- messages to be inserted into the trace log +trace.debug( + value1, -- value to be converted to a string and included in the debug output + value2, -- another value to be converted to a string and included in the debug output + ... +) -This function can be used to include debug output in the trace log. +This function can be used to include debug output in the trace log. Each argument is converted to a string (using tostring(...)) and all results are concatenated with a single space character between them. --]]-- function trace.debug(...) if not trace._disabled then - local message = "" - local arg = {...} - for i= 1,#arg,1 do - message = message..tostring(arg[i]).." " + local values = {} + for i = 1, select("#", ...) do + values[i] = tostring((select(i, ...))) end - trace._new_entry{ type = "debug", message = message } + trace._new_entry{ type = "debug", message = table.concat(values, " ") } end end