From 75ce1622c65240df4017b79d123f64cb6ae8d4c8 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 9 Apr 2017 13:24:22 +0800 Subject: fix print api bug for --- xmake/core/sandbox/modules/utils.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index f09f8ccf5..b2d567015 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -41,6 +41,23 @@ for k, v in pairs(utils) do end end +-- print each arguments +function sandbox_utils._print(...) + + -- format each arguments + local args = {} + for _, arg in ipairs({...}) do + if type(arg) == "string" then + table.insert(args, vformat(arg)) + else + table.insert(args, arg) + end + end + + -- print multi-variables with raw lua action + utils._print(unpack(args)) +end + -- print format string with newline -- print builtin-variables with $(var) -- print multi-variables with raw lua action @@ -61,14 +78,14 @@ function sandbox_utils.print(format, ...) { function () -- print multi-variables with raw lua action - utils._print(format, unpack(args)) + sandbox_utils._print(format, unpack(args)) end } } else -- print multi-variables with raw lua action - utils._print(format, ...) + sandbox_utils._print(format, ...) end end -- cgit v1.3.1