Posted 08 April 2017 - 07:01 PM
I'm pretty confused, I'm using OpenCCSensors to detect an inventory, upon doing so I use the following:
When I do this it prints:
However, when I replace 'print("Table: " .. tostring(t[1]))' with 'print("Table: " .. tostring(t["0,0,0"]))' it works as it should, and prints a table id. However, stated and shown in the table wiki (this part, if you're wondering) it shows I should be able to do this. Why can't I view the result with the position of the result in the table?
os.loadAPI("ocs/apis/sensor")
local s = sensor.wrap("back")
local t = s.getTargets()
print(textutils.serialize(t)) -- Find out where the table lies
print("Table: " .. tostring(t[1]))
When I do this it prints:
{
[ "0,0,0" ] = {
RawName = "net.sensor",
DamageValue = 3,
Name = "Sensor",
Position = {
Y = 0,
X = 0,
Z = 0,
},
InventoryPercentFull = 1.5625,
TotalSpace = 64,
ItemCount = 1,
},
}
Table: nil
However, when I replace 'print("Table: " .. tostring(t[1]))' with 'print("Table: " .. tostring(t["0,0,0"]))' it works as it should, and prints a table id. However, stated and shown in the table wiki (this part, if you're wondering) it shows I should be able to do this. Why can't I view the result with the position of the result in the table?