summaryrefslogtreecommitdiff
path: root/xmake/scripts
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
parent6ba8d0eb8d09d5170242837ef091c04ab4da6047 (diff)
uses table.insert
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/base/option.lua6
-rw-r--r--xmake/scripts/base/project.lua2
-rw-r--r--xmake/scripts/base/utils.lua4
-rw-r--r--xmake/scripts/compiler/compiler.lua2
-rw-r--r--xmake/scripts/linker/linker.lua2
-rw-r--r--xmake/scripts/platform/platform.lua6
6 files changed, 11 insertions, 11 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
diff --git a/xmake/scripts/compiler/compiler.lua b/xmake/scripts/compiler/compiler.lua
index e1dbb9658..6bd6561af 100644
--- a/xmake/scripts/compiler/compiler.lua
+++ b/xmake/scripts/compiler/compiler.lua
@@ -50,7 +50,7 @@ function compiler._mapflags(self, flags)
-- map it
local flag_mapped = self._mapflag(configs, flag)
if flag_mapped then
- flags_mapped[table.getn(flags_mapped) + 1] = flag_mapped
+ table.insert(flags_mapped, flag_mapped)
end
end
diff --git a/xmake/scripts/linker/linker.lua b/xmake/scripts/linker/linker.lua
index efccdbfb1..d5338271a 100644
--- a/xmake/scripts/linker/linker.lua
+++ b/xmake/scripts/linker/linker.lua
@@ -49,7 +49,7 @@ function linker._mapflags(self, flags)
-- map it
local flag_mapped = self._mapflag(configs, flag)
if flag_mapped then
- flags_mapped[table.getn(flags_mapped) + 1] = flag_mapped
+ table.insert(flags_mapped, flag_mapped)
end
end
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index e968137fd..01728106b 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -195,7 +195,7 @@ function platform.archs(plat)
local p = platform._load(plat)
if p and p._ARCHS then
for _, arch in ipairs(p._ARCHS) do
- archs[table.getn(archs) + 1] = arch
+ table.insert(archs, arch)
end
end
@@ -245,11 +245,11 @@ function platform.menu(action)
local name = option[2]
if name then
if not exist[name] then
- menus[table.getn(menus) + 1] = option
+ table.insert(menus, option)
exist[name] = true
end
else
- menus[table.getn(menus) + 1] = option
+ table.insert(menus, option)
end
end
end