mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-23 04:45:24 +02:00
Faster insertion into table
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user