Allow passing wrapped inventories directly to Chest
This commit is contained in:
parent
a124e870c7
commit
56ef9cae04
@ -4,14 +4,17 @@ local Chest = {}
|
|||||||
Chest.__index = Chest
|
Chest.__index = Chest
|
||||||
|
|
||||||
-- Homogeneity allows chest scan to clone empty itemDetail slot to all empty slots in chest
|
-- Homogeneity allows chest scan to clone empty itemDetail slot to all empty slots in chest
|
||||||
function Chest:fromPeripheral(name, homogeneous)
|
function Chest:fromPeripheral(chest, homogeneous)
|
||||||
local chest = peripheral.wrap(name)
|
if type(chest) == "string" then
|
||||||
|
chest = peripheral.wrap(chest)
|
||||||
|
end
|
||||||
|
|
||||||
if chest == nil then
|
if chest == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local obj = {
|
local obj = {
|
||||||
name = name,
|
name = peripheral.getName(chest),
|
||||||
chest = chest,
|
chest = chest,
|
||||||
size = chest.size(),
|
size = chest.size(),
|
||||||
homogeneous = homogeneous
|
homogeneous = homogeneous
|
||||||
|
Loading…
x
Reference in New Issue
Block a user