From 76a9efff71f924b143af8945ce02ed336b6a1090 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 5 Feb 2015 10:03:07 +0100 Subject: reduce table lookups during initialization --- init.lua | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 85bf293..ebc5fda 100644 --- a/init.lua +++ b/init.lua @@ -3,33 +3,37 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) local worldpath = minetest.get_worldpath() + -- Data tables definitions -unified_inventory = {} -unified_inventory.activefilter = {} -unified_inventory.active_search_direction = {} -unified_inventory.alternate = {} -unified_inventory.current_page = {} -unified_inventory.current_searchbox = {} -unified_inventory.current_index = {} -unified_inventory.current_item = {} -unified_inventory.current_craft_direction = {} -unified_inventory.registered_craft_types = {} -unified_inventory.crafts_for = { usage = {}, recipe = {} } -unified_inventory.players = {} -unified_inventory.items_list_size = 0 -unified_inventory.items_list = {} -unified_inventory.filtered_items_list_size = {} -unified_inventory.filtered_items_list = {} -unified_inventory.pages = {} -unified_inventory.buttons = {} - --- Homepos stuff -unified_inventory.home_pos = {} -unified_inventory.home_filename = - worldpath.."/unified_inventory_home.home" - --- Default inventory page -unified_inventory.default = "craft" +unified_inventory = { + activefilter = {}, + active_search_direction = {}, + alternate = {}, + current_page = {}, + current_searchbox = {}, + current_index = {}, + current_item = {}, + current_craft_direction = {}, + registered_craft_types = {}, + crafts_for = {usage = {}, recipe = {} }, + players = {}, + items_list_size = 0, + items_list = {}, + filtered_items_list_size = {}, + filtered_items_list = {}, + pages = {}, + buttons = {}, + + -- Homepos stuff + home_pos = {}, + home_filename = worldpath.."/unified_inventory_home.home", + + -- Default inventory page + default = "craft", + + -- intllib + gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end, +} -- Disable default creative inventory if rawget(_G, "creative_inventory") then -- cgit v1.2.3