diff options
| author | Opportunity <[email protected]> | 2020-01-15 12:06:01 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-01-15 12:06:01 +0800 |
| commit | f4e30b5e7879d4dbfbe4424f5f9156cb6cfdaf50 (patch) | |
| tree | bbd6789a15b4ffbe2040eba9dd61a047f92b2fcc /xmake/core/base/utils.lua | |
| parent | 9862d1b95fa5978eaf24d65f1ca5f151d410a14b (diff) | |
Improve dump
Diffstat (limited to 'xmake/core/base/utils.lua')
| -rw-r--r-- | xmake/core/base/utils.lua | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index ca13ab097..fa42d7e25 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -29,7 +29,7 @@ local log = require("base/log") local io = require("base/io") local dump = require("base/dump") --- dump value +-- dump values function utils.dump(...) if option.get("quiet") then return ... @@ -49,25 +49,16 @@ function utils.dump(...) if values.n == 0 then return end - local indent = nil - local values_count = values.n - values.n = nil - -- use last input as indent if it is a string - if values_count > 1 and type(values[values_count]) == "string" then - indent = values[values_count] - values[values_count] = nil - values_count = values_count - 1 - end - if values_count == 1 then - dump(values[1], indent or "", diagnosis) + if values.n == 1 then + dump(values[1], "", diagnosis) else - for i = 1, values_count do - dump(values[i], indent or string.format("%2d: ", i), diagnosis) + for i = 1, values.n do + dump(values[i], string.format("%2d: ", i), diagnosis) end end - return table.unpack(values, 1, values_count) + return table.unpack(values, 1, values.n) end -- print string with newline |
