Just a quick question about nested tables, I have this:
Code: Select all
msgbox = {
padding = 10,
container = {
x = 10,
y = screen.H/2,
w = screen.W-msgbox.padding*2,
h = screen.H/5-msgbox.padding,
},
text = {
x = msgbox.container.x,
y = msgbox.container.y
},
}
I would assume that for msgbox.container.w, where w= screen.W (screen width) -
msgbox.padding*2 that it would simply be equal to screen.W-10, since msgbox.padding = 10, but I receive and error that says:
attempt to perform arithmetic on global 'padding' a nil value
Maybe I'm missing something here with nested tables, maybe one of you smarter people can give me a hand as to why I keep getting this?
I also tried moving padding outside the table and just named it padding, e.g. w = screen.W-padding, which worked fine, but then I would also get and error in msgbox.text, saying the same thing, so I'm certain it's a fault in my understanding of tables
