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

List table keys

Started by wrothmonk, 18 May 2014 - 03:10 AM
wrothmonk #1
Posted 18 May 2014 - 05:10 AM
I've been working with open peripherals for the past couple of days and I've come to realize that most of the data comes back in tables with the keys being individual strings that describe the data. Unfortunately there appears to be no documentation relating to what each of the keys are specifically called. Is there any way to get a list of the keys in a table, or will I just have to take a guess at each one?

EDIT: I'm an idiot. I didn't check the How to use tables post in the tutorial section.
Edited on 18 May 2014 - 03:18 AM
awsmazinggenius #2
Posted 18 May 2014 - 05:13 AM

for k, _ in pairs(YOUR_TABLE_HERE) do
  print(k)
end