This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
austinv11's profile picture

OpenPeripherals: Sensor documentation?

Started by austinv11, 01 May 2014 - 10:40 PM
austinv11 #1
Posted 02 May 2014 - 12:40 AM
I know how to get documentation in game, but I want more detail on the return of the getPlayerData() method. I know it returns a table, but I wanna know all the values in the table and such
CometWolf #2
Posted 02 May 2014 - 12:44 AM
It's silly that we have to do this, but use a pairs for loop to get the contents of the table.

for k,v in pairs(table) do
  print(k.." : "..v)
end
austinv11 #3
Posted 02 May 2014 - 12:51 AM
It's silly that we have to do this, but use a pairs for loop to get the contents of the table.

for k,v in pairs(table) do
  print(k.." : "..v)
end
i know that, but the table has tables in it, and that table has tables in it, its all really confusinng and I don't know what some of the return values are for. Health? Coords? Idk
CometWolf #4
Posted 02 May 2014 - 12:55 AM
You're using a sensor, what do you think coords and health is…?
Just look at the results of the loop and use your head. If you know an index holds a table, then loop that instead.

for k,v in pairs(table.index) do
  print(k.." : "..v)
end