diff options
| author | ruki <[email protected]> | 2017-05-18 16:28:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-18 16:28:43 +0800 |
| commit | 75cfb11546cd271ebb8b251d291ad9c7b6277b66 (patch) | |
| tree | a54d87f951beef41ae0be1be17cd47d849b2e416 /xmake/core/base/utils.lua | |
| parent | 102c4ce16295fe322704b6e5186f325effa989a8 (diff) | |
improve print and table.dump
Diffstat (limited to 'xmake/core/base/utils.lua')
| -rw-r--r-- | xmake/core/base/utils.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index 030c10d5c..3bda8060c 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -29,13 +29,29 @@ local utils = utils or {} local option = require("base/option") local colors = require("base/colors") local string = require("base/string") +local table = require("base/table") -- print string with newline function utils._print(...) -- print it if not quiet if not option.get("quiet") then - print(...) + local values = {...} + for i, v in ipairs(values) do + -- dump basic type + if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then + io.write(tostring(v)) + -- dump table + elseif type(v) == "table" then + table.dump(v) + else + io.write("<" .. tostring(v) .. ">") + end + if i ~= #values then + io.write(" ") + end + end + io.write('\n') end end |
