aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
authorRui914 <rui914t@gmail.com>2016-03-07 00:53:45 +0900
committerparamat <mat.gregory@virginmedia.com>2016-03-06 23:42:04 +0000
commit24e8b0ac1ea45719937948607259f13866c8bc64 (patch)
treef8bb110a59ca436d2a7a15686da8feab160a1c93 /builtin/mainmenu
parent75db0543f3df4b30ce23731f5008d0c9afa277ff (diff)
downloadminetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.gz
minetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.bz2
minetest-24e8b0ac1ea45719937948607259f13866c8bc64.zip
Faster insertion into table
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/common.lua4
-rw-r--r--builtin/mainmenu/modmgr.lua6
-rw-r--r--builtin/mainmenu/tab_mods.lua2
-rw-r--r--builtin/mainmenu/tab_texturepacks.lua2
4 files changed, 7 insertions, 7 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index f4020aaaf..f40c787a2 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -67,13 +67,13 @@ function order_favorite_list(list)
for i=1,#list,1 do
local fav = list[i]
if is_server_protocol_compat(fav.proto_min, fav.proto_max) then
- table.insert(res, fav)
+ res[#res + 1] = fav
end
end
for i=1,#list,1 do
local fav = list[i]
if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then
- table.insert(res, fav)
+ res[#res + 1] = fav
end
end
return res
diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua
index 41e747b33..f996df7ba 100644
--- a/builtin/mainmenu/modmgr.lua
+++ b/builtin/mainmenu/modmgr.lua
@@ -23,7 +23,7 @@ function get_mods(path,retval,modpack)
if name:sub(1, 1) ~= "." then
local prefix = path .. DIR_DELIM .. name .. DIR_DELIM
local toadd = {}
- table.insert(retval, toadd)
+ retval[#retval + 1] = toadd
local mod_conf = Settings(prefix .. "mod.conf"):to_table()
if mod_conf.name then
@@ -412,7 +412,7 @@ function modmgr.preparemodlist(data)
for i=1,#global_mods,1 do
global_mods[i].typ = "global_mod"
- table.insert(retval,global_mods[i])
+ retval[#retval + 1] = global_mods[i]
end
--read game mods
@@ -421,7 +421,7 @@ function modmgr.preparemodlist(data)
for i=1,#game_mods,1 do
game_mods[i].typ = "game_mod"
- table.insert(retval,game_mods[i])
+ retval[#retval + 1] = game_mods[i]
end
if data.worldpath == nil then
diff --git a/builtin/mainmenu/tab_mods.lua b/builtin/mainmenu/tab_mods.lua
index 2ddc9b07c..af758f8df 100644
--- a/builtin/mainmenu/tab_mods.lua
+++ b/builtin/mainmenu/tab_mods.lua
@@ -78,7 +78,7 @@ local function get_formspec(tabview, name, tabdata)
descriptionfile:close()
else
descriptionlines = {}
- table.insert(descriptionlines,fgettext("No mod description available"))
+ descriptionlines[#descriptionlines + 1] = fgettext("No mod description available")
end
retval = retval ..
diff --git a/builtin/mainmenu/tab_texturepacks.lua b/builtin/mainmenu/tab_texturepacks.lua
index d8b9ba35f..d669d5682 100644
--- a/builtin/mainmenu/tab_texturepacks.lua
+++ b/builtin/mainmenu/tab_texturepacks.lua
@@ -20,7 +20,7 @@ local function filter_texture_pack_list(list)
local retval = {}
for _, item in ipairs(list) do
if item ~= "base" then
- table.insert(retval, item)
+ retval[#retval + 1] = item
end
end