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)
local chest = {
peripheral = per,
slots = {},
size = 0
}
if type(per) == "string" then
per = peripheral.wrap(per)
end
setmetatable(chest, metatable)
local chest = {
peripheral = per,
slots = {},
size = 0
}
return chest
setmetatable(chest, metatable)
return chest
end
function localchest.fromString(str)