diff options
| author | ruki <[email protected]> | 2019-06-20 00:41:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-19 22:08:36 +0800 |
| commit | a4d6849c8b18d32e0dd97c54b95ed49c2c3acb76 (patch) | |
| tree | a23f7389e6a1aa66cf6efc3b2f79ca5170613915 | |
| parent | 368904bc150e3aeee0e906674a00f84cdd81f303 (diff) | |
revert table.pack
| -rw-r--r-- | xmake/core/base/table.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/sandbox/sandbox.lua | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index 74b4723c2..3fd35c082 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -258,7 +258,7 @@ end -- pack arguments into a table function table.pack(...) - return { len = select("#", ...), ... } + return { n = select("#", ...), ... } end -- unpack table values diff --git a/xmake/core/sandbox/modules/import/core/sandbox/sandbox.lua b/xmake/core/sandbox/modules/import/core/sandbox/sandbox.lua index 8580c0685..5aa55a0c6 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/sandbox.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/sandbox.lua @@ -35,21 +35,21 @@ local dump = require("base/dump") function sandbox_core_sandbox._interactive_dump(...) local values = table.pack(...) -- do not use #values since nil might be included - local len = values.len - if len <= 1 then + local n = values.n + if n <= 1 then dump(values[1], "< ") io.write("\n") else local fmt = "< %d: " - if len >= 1000 then + if n >= 1000 then -- try `unpack({}, 1, 5000)`, wish you happy! fmt = "< %4d: " - elseif len >= 100 then + elseif n >= 100 then fmt = "< %3d: " - elseif len >= 10 then + elseif n >= 10 then fmt = "< %2d: " end - for i = 1, len do + for i = 1, n do dump(values[i], string.format(fmt, i)) io.write("\n") end |
