Log In  

Not sure if bugs is the right place to put this...

Is it possible to retrieve a variable within a table within a table within a table and so on?

tables = {
   table = {
   a = {x=0,y=0}
   b = {x=64,y=94}
   c = {x=0,y=0}

print(tables.table[2][2],0,0,1) -- this is not how it works

If I wanted to print "b.x" and "c.y" at the same time in the most conventional way possible, how would I go about that?

P#100873 2021-11-27 04:17


you are mixing indexed notation with named notation.
see: http://lua-users.org/wiki/TablesTutorial

(TL;DR: tables.table.a.x is the answer)

P#100886 2021-11-27 07:52

@freds72 ok thank you.

P#100915 2021-11-27 21:22

@Ummmm_ok if this was a bug and it was removed, MY GAME WOULD NOT WORK ANYMORE!!!

P#115453 2022-08-08 13:57

[Please log in to post a comment]