reduce table lookups during initialization
This commit is contained in:
parent
1a1bfc3839
commit
76a9efff71
7
api.lua
7
api.lua
@ -1,9 +1,4 @@
|
|||||||
local S
|
local S = unified_inventory.gettext
|
||||||
if rawget(_G, "intllib") then
|
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function(s) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create detached creative inventory after loading all mods
|
-- Create detached creative inventory after loading all mods
|
||||||
minetest.after(0.01, function()
|
minetest.after(0.01, function()
|
||||||
|
7
bags.lua
7
bags.lua
@ -3,12 +3,7 @@
|
|||||||
-- Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
-- Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
||||||
-- License: GPLv3
|
-- License: GPLv3
|
||||||
|
|
||||||
local S
|
local S = unified_inventory.gettext
|
||||||
if rawget(_G, "intllib") then
|
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function(s) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
unified_inventory.register_page("bags", {
|
unified_inventory.register_page("bags", {
|
||||||
get_formspec = function(player)
|
get_formspec = function(player)
|
||||||
|
48
init.lua
48
init.lua
@ -3,33 +3,37 @@
|
|||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local worldpath = minetest.get_worldpath()
|
local worldpath = minetest.get_worldpath()
|
||||||
|
|
||||||
|
|
||||||
-- Data tables definitions
|
-- Data tables definitions
|
||||||
unified_inventory = {}
|
unified_inventory = {
|
||||||
unified_inventory.activefilter = {}
|
activefilter = {},
|
||||||
unified_inventory.active_search_direction = {}
|
active_search_direction = {},
|
||||||
unified_inventory.alternate = {}
|
alternate = {},
|
||||||
unified_inventory.current_page = {}
|
current_page = {},
|
||||||
unified_inventory.current_searchbox = {}
|
current_searchbox = {},
|
||||||
unified_inventory.current_index = {}
|
current_index = {},
|
||||||
unified_inventory.current_item = {}
|
current_item = {},
|
||||||
unified_inventory.current_craft_direction = {}
|
current_craft_direction = {},
|
||||||
unified_inventory.registered_craft_types = {}
|
registered_craft_types = {},
|
||||||
unified_inventory.crafts_for = { usage = {}, recipe = {} }
|
crafts_for = {usage = {}, recipe = {} },
|
||||||
unified_inventory.players = {}
|
players = {},
|
||||||
unified_inventory.items_list_size = 0
|
items_list_size = 0,
|
||||||
unified_inventory.items_list = {}
|
items_list = {},
|
||||||
unified_inventory.filtered_items_list_size = {}
|
filtered_items_list_size = {},
|
||||||
unified_inventory.filtered_items_list = {}
|
filtered_items_list = {},
|
||||||
unified_inventory.pages = {}
|
pages = {},
|
||||||
unified_inventory.buttons = {}
|
buttons = {},
|
||||||
|
|
||||||
-- Homepos stuff
|
-- Homepos stuff
|
||||||
unified_inventory.home_pos = {}
|
home_pos = {},
|
||||||
unified_inventory.home_filename =
|
home_filename = worldpath.."/unified_inventory_home.home",
|
||||||
worldpath.."/unified_inventory_home.home"
|
|
||||||
|
|
||||||
-- Default inventory page
|
-- Default inventory page
|
||||||
unified_inventory.default = "craft"
|
default = "craft",
|
||||||
|
|
||||||
|
-- intllib
|
||||||
|
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
|
||||||
|
}
|
||||||
|
|
||||||
-- Disable default creative inventory
|
-- Disable default creative inventory
|
||||||
if rawget(_G, "creative_inventory") then
|
if rawget(_G, "creative_inventory") then
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
local S
|
local S = unified_inventory.gettext
|
||||||
if rawget(_G, "intllib") then
|
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function(s) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This pair of encoding functions is used where variable text must go in
|
-- This pair of encoding functions is used where variable text must go in
|
||||||
-- button names, where the text might contain formspec metacharacters.
|
-- button names, where the text might contain formspec metacharacters.
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
local S
|
local S = unified_inventory.gettext
|
||||||
if rawget(_G, "intllib") then
|
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function(s) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_privilege("creative", {
|
minetest.register_privilege("creative", {
|
||||||
description = "Can use the creative inventory",
|
description = "Can use the creative inventory",
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
local S
|
local S = unified_inventory.gettext
|
||||||
if rawget(_G, "intllib") then
|
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function(s) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
local hud_colors = {
|
local hud_colors = {
|
||||||
{"#FFFFFF", 0xFFFFFF, S("White")},
|
{"#FFFFFF", 0xFFFFFF, S("White")},
|
||||||
|
Loading…
Reference in New Issue
Block a user