Fix stuff
This commit is contained in:
parent
a0c445d2ce
commit
ce9f65ac7a
@ -13,9 +13,9 @@ local BUFFER_OUT_SLOT = 1
|
|||||||
local BUFFER_IN_SLOT = 2
|
local BUFFER_IN_SLOT = 2
|
||||||
|
|
||||||
-- Find all chests or shulker boxes
|
-- Find all chests or shulker boxes
|
||||||
local inventories = w.find_peripherals(function(type, name, wrapped)
|
local inventories = d.map_with_key(function(_, p) return p.name, p.wrapped end, w.find_peripherals(function(type, name, wrapped)
|
||||||
return string.find(name, "chest") or string.find(name, "shulker")
|
return string.find(name, "chest") or string.find(name, "shulker")
|
||||||
end)
|
end))
|
||||||
|
|
||||||
local display_name_cache = {}
|
local display_name_cache = {}
|
||||||
|
|
||||||
|
4
lib.lua
4
lib.lua
@ -188,14 +188,14 @@ local function find_peripherals(predicate)
|
|||||||
for k, name in pairs(peripheral.getNames()) do
|
for k, name in pairs(peripheral.getNames()) do
|
||||||
local wrapped = peripheral.wrap(name)
|
local wrapped = peripheral.wrap(name)
|
||||||
local type = peripheral.getType(name)
|
local type = peripheral.getType(name)
|
||||||
if predicate(type, name, wrapped) then table.insert(matching, wrapped) end
|
if predicate(type, name, wrapped) then table.insert(matching, { wrapped = wrapped, name = name} ) end
|
||||||
end
|
end
|
||||||
return matching
|
return matching
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set up stuff for running this library's features (currently, modem initialization)
|
-- Set up stuff for running this library's features (currently, modem initialization)
|
||||||
local function init()
|
local function init()
|
||||||
d.map(find_peripherals(function(type, name, wrapped) return type == "modem" end), rednet.open)
|
d.map(find_peripherals(function(type, name, wrapped) return type == "modem" end), function(p) rednet.open(p.name) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { errors = errors, serve = serve, query_by_ID = query_by_ID, query_by_type = query_by_type, get_internal_identifier = get_internal_identifier, load_config = load_config, find_peripherals = find_peripherals, init = init }
|
return { errors = errors, serve = serve, query_by_ID = query_by_ID, query_by_type = query_by_type, get_internal_identifier = get_internal_identifier, load_config = load_config, find_peripherals = find_peripherals, init = init }
|
Loading…
Reference in New Issue
Block a user