-
I don't understand how to actually know a peripheral's type using the "peripheral.getType" method. So when you just enter the command : peripheral.getType("name"), However, when you try to plug that result into a table, it only registers the name of the peripheral, not it's actual type. I was expecting it to be registered as a table where index 1 = name and index 2 = type but it doesn't seem to work that way, despite what the CC:T documentation claims. var = peripheral.getType("minecraft:chest_0")
print(type(var))
returns : "string"
print(var)
returns : "minecraft:chest" As you can see, it gets registered as a string, not a table. What I want to know is if that peripheral is an "inventory" or not. Am I missing something obvious ? Thanks in advance for the help, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To clarify the documentation, it's the argument that can be a table, not the return value. This means you can do both
|
Beta Was this translation helpful? Give feedback.
To clarify the documentation, it's the argument that can be a table, not the return value. This means you can do both
peripheral.getType("top")
orperipheral.getType(peripheral.wrap("top"))
.getType
will return multiple values — that can be put into a table with{peripheral.getType("top")}
. You can then loop over that table and look for the"inventory"
string, but it's probably easier to callperipheral.hasType("top", "inventory")
.