If Lopus590s answer doesn't help your problem, you may want to perform an index operation?:
print(items.dirt[1]) --#prints $1
print(items.cables[1]) --#prints $10
I don't know, why you are putting them into a second layer of tables, though.
In your rather simple example, you could do the following:
local items = {
["dirt"] ="$1",
["cables"] = "$10"
}
print(items.dirt) --#prints $1
print(items.cables) --#prints $10
But maybe you want to add more properties other than the price to the item as well, then your way fits nice as it is.
PS: I'm not exactly sure, but you may want your datasets to not include the currency and have the price as a number, so you can calculate arithmetic operations against them ;)/>
You can always add the currency later, removing the currency however is not so easy and consumes more time that isn't needed
If you do want to retrieve the keys available in a table, Lopus590s answer is the one to follow ;)/> Just be sure to never call your actual table you are working on "table" ;)/>