I'm fairly new to CC programming from scratch, most my experiance is with adapting basic programs to fit my needs so bare with me. I'm trying to design a simple program that looks for nearby players and prints the list to a monitor, however I'm having a hard time understanding the new syntax for the sensor.getPlayers. It outputs a table, however the table is always returned as something like "table: 6beec85", my question is how do you translate the table into names, or is there a better method that I'm just not seeing?
openperipherials sensor help
Started by DotaCross, Feb 27 2015 10:38 PM
1 reply to this topic
#1
Posted 27 February 2015 - 10:38 PM
#2
Posted 28 February 2015 - 12:00 PM
for key, value in pairs(myTable) do print(key..": "..tostring(value)) end
Let's say you did this, and discovered that there's a sub-table in your first table with eg a key-name of "inventory", or somesuch. You'd then iterate through that:
for key, value in pairs(myTable.inventory) do print(key..": "..tostring(value)) end
... and so on.
If you're still stuck, post the code you're using.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











