Is it possible to edit the contents of a table which is inside another table using a function?
local MainTable = {
  subtable = {
    x = 0,
    y = 0
 }, 
 addX = function() 
  subtable.x = subtable.x + 1
 end
}
I'm getting the error attempt to index ? (a nil value) Is it possible to achieve this? It works outside the table, I used:
print(MainTable.subtable.x+1)
How come it doesn't work inside the table? Does tables being objects play a role?
Thank you!
 
    