diff --git a/core/inventory/ScanInventory.lua b/core/inventory/ScanInventory.lua index 45c9bd4..8ae47d0 100644 --- a/core/inventory/ScanInventory.lua +++ b/core/inventory/ScanInventory.lua @@ -41,10 +41,12 @@ return true end -local function predicateMatches(predicates, item) - local meta = peripheral.call(item.inventory, "getItemDetail", item.slot) - item.cachedMeta = meta - return partialObjectMatches(predicates, meta) +local function predicateMatches(predicates, item, allowCached) + if not allowCached or not item.cachedMeta then + local meta = peripheral.call(item.inventory, "getItemDetail", item.slot) + item.cachedMeta = meta + end + return partialObjectMatches(predicates, item.cachedMeta) end local function findMatchingProducts(products, item) @@ -52,7 +54,7 @@ for i = 1, #products do local product = products[i] if item.name == product.modid then - if not product.predicates or predicateMatches(product.predicates, item) then + if not product.predicates or predicateMatches(product.predicates, item, true) then table.insert(matchingProducts, product) end end diff --git a/radon.lua b/radon.lua index 1133e60..6fdeee9 100644 --- a/radon.lua +++ b/radon.lua @@ -1,4 +1,4 @@ -local version = "1.3.13" +local version = "1.3.14" local configHelpers = require "util.configHelpers" local schemas = require "core.schemas" local oldPullEvent = os.pullEvent