From 310b12b5edaaa415e664a7766b9226fc95ce89e4 Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Sun, 18 Sep 2022 11:46:48 -0400 Subject: Content ID caching in Lua (#12444) * Cache content IDs in Lua Co-authored-by: sfan5 --- builtin/async/game.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'builtin/async') diff --git a/builtin/async/game.lua b/builtin/async/game.lua index 6512f0706..0b7a7ef0e 100644 --- a/builtin/async/game.lua +++ b/builtin/async/game.lua @@ -13,9 +13,12 @@ end -- Import a bunch of individual files from builtin/game/ local gamepath = core.get_builtin_path() .. "game" .. DIR_DELIM +local commonpath = core.get_builtin_path() .. "common" .. DIR_DELIM + +local builtin_shared = {} dofile(gamepath .. "constants.lua") -dofile(gamepath .. "item_s.lua") +assert(loadfile(commonpath .. "item_s.lua"))(builtin_shared) dofile(gamepath .. "misc_s.lua") dofile(gamepath .. "features.lua") dofile(gamepath .. "voxelarea.lua") @@ -57,3 +60,5 @@ setmetatable(core.registered_items, alias_metatable) setmetatable(core.registered_nodes, alias_metatable) setmetatable(core.registered_craftitems, alias_metatable) setmetatable(core.registered_tools, alias_metatable) + +builtin_shared.cache_content_ids() -- cgit v1.2.3