Wrap peripheral if string is given instead of table

This commit is contained in:
Gabriel Tofvesson 2025-05-15 18:03:59 +02:00
parent 3dabc55825
commit 742f8eb81d

View File

@ -108,15 +108,19 @@ local metatable = {
} }
function localchest.fromPeripheral(per) function localchest.fromPeripheral(per)
local chest = { if type(per) == "string" then
peripheral = per, per = peripheral.wrap(per)
slots = {}, end
size = 0
}
setmetatable(chest, metatable) local chest = {
peripheral = per,
slots = {},
size = 0
}
return chest setmetatable(chest, metatable)
return chest
end end
function localchest.fromString(str) function localchest.fromString(str)