summaryrefslogtreecommitdiff
path: root/xmake/scripts/base
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-03 13:53:44 +0800
committerruki <[email protected]>2015-06-03 13:53:44 +0800
commitbcb0d8e7eb53865f627cadd79eb181de34e86f5a (patch)
treeca0300e883af6093b54985e797311d820da68d4c /xmake/scripts/base
parent6ba8d0eb8d09d5170242837ef091c04ab4da6047 (diff)
uses table.insert
Diffstat (limited to 'xmake/scripts/base')
-rw-r--r--xmake/scripts/base/option.lua6
-rw-r--r--xmake/scripts/base/project.lua2
-rw-r--r--xmake/scripts/base/utils.lua4
3 files changed, 6 insertions, 6 deletions
diff --git a/xmake/scripts/base/option.lua b/xmake/scripts/base/option.lua
index 5393e0f9b..df1fb54cb 100644
--- a/xmake/scripts/base/option.lua
+++ b/xmake/scripts/base/option.lua
@@ -44,11 +44,11 @@ function option._save_menu(menu)
local _options = option()
if _options then
for _, o in ipairs(_options) do
- options_all[table.getn(options_all) + 1] = o
+ table.insert(options_all, o)
end
end
else
- options_all[table.getn(options_all) + 1] = option
+ table.insert(options_all, option)
end
end
@@ -281,7 +281,7 @@ function option.init(argv, menu)
end
-- append value
- o[table.getn(o) + 1] = key
+ table.insert(o, key)
end
else
-- invalid option
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua
index ce6397163..3fc119330 100644
--- a/xmake/scripts/base/project.lua
+++ b/xmake/scripts/base/project.lua
@@ -98,7 +98,7 @@ function project._make_configs(scope, configs)
local item = scope[k]
-- append it
- item[table.getn(item) + 1] = _v
+ table.insert(item, _v)
end
-- replace configure to scope
elseif scope and not k:startswith("_") then
diff --git a/xmake/scripts/base/utils.lua b/xmake/scripts/base/utils.lua
index c51e9eeb2..469fb4a4a 100644
--- a/xmake/scripts/base/utils.lua
+++ b/xmake/scripts/base/utils.lua
@@ -186,12 +186,12 @@ function utils.unique(array)
if type(v) == "string" then
if not exists[v] then
exists[v] = true
- unique[table.getn(unique) + 1] = v
+ table.insert(unique, v)
end
else
if not exists["\"" .. v .. "\""] then
exists["\"" .. v .. "\""] = true
- unique[table.getn(unique) + 1] = v
+ table.insert(unique, v)
end
end
end