A = {x = 10} B = {x = 20, y = 30} mt = {__index = B} print(A.x, A.y) setmetatable(A, mt) print(A.x, A.y)