aboutsummaryrefslogtreecommitdiff
path: root/builtin/fstk
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/fstk
parent75db0543f3df4b30ce23731f5008d0c9afa277ff (diff)
downloadminetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.gz
minetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.bz2
minetest-24e8b0ac1ea45719937948607259f13866c8bc64.zip
Faster insertion into table
Diffstat (limited to 'builtin/fstk')
-rw-r--r--builtin/fstk/buttonbar.lua7
-rw-r--r--builtin/fstk/tabview.lua2
2 files changed, 7 insertions, 2 deletions
diff --git a/builtin/fstk/buttonbar.lua b/builtin/fstk/buttonbar.lua
index 1ad175624..465588324 100644
--- a/builtin/fstk/buttonbar.lua
+++ b/builtin/fstk/buttonbar.lua
@@ -145,7 +145,12 @@ local buttonbar_metatable = {
if image == nil then image = "" end
if tooltip == nil then tooltip = "" end
- table.insert(self.buttons,{ name=name, caption=caption, image=image, tooltip=tooltip})
+ self.buttons[#self.buttons + 1] = {
+ name = name,
+ caption = caption,
+ image = image,
+ tooltip = tooltip
+ }
if self.orientation == "horizontal" then
if ( (self.btn_size * #self.buttons) + (self.btn_size * 0.05 *2)
> self.size.x ) then
diff --git a/builtin/fstk/tabview.lua b/builtin/fstk/tabview.lua
index c65f6dd7f..72551afd7 100644
--- a/builtin/fstk/tabview.lua
+++ b/builtin/fstk/tabview.lua
@@ -46,7 +46,7 @@ local function add_tab(self,tab)
tabdata = {},
}
- table.insert(self.tablist,newtab)
+ self.tablist[#self.tablist + 1] = newtab
if self.last_tab_index == #self.tablist then
self.current_tab = tab.name