Hmmm ok well I tried what you've told me however I can't seem to get it to work. I'm trying to use this for my button API which you can view here:
http://pastebin.com/mhrJyz1X
When I first posted the topic I did have "local" in front of my table however removing it has made no difference.
I'm working on a potion shop with this code:
http://pastebin.com/aPteuSAP
And I'm trying to access the table on line 55 like this:
color = btn.button["name"]["color"]
Color being defined as a variable for the function.
I get the following error:
PS:55: attempt to index ? (a nil value)
I'm sure I'm just messing something up so if someone could tell me what it is, that would be great.