Mesh.vertices behaves... differently?

In the following snippet, why doesn’t m.vertices behave like c?

a = vec3(6,6,6)
c = {a}
m = mesh()
m.vertices = {a}
print(c[1].x)           -- 6
print(m.vertices[1].x)  -- 6
a.x = 666
print(c[1].x)           -- 666
print(m.vertices[1].x)  -- 6(?!)

Edit: code formatting

And how do I format code here?

mesh.vertices copies the table when you assign to it — it doesn’t hold a reference.

So for example:

local myVerts = { ... some verts ... }

-- This *copies* myVerts into m.vertices, allocating the internal buffer if necessary
m.vertices = myVerts

table.insert( myVerts, newVertex ) -- does not effect mesh m

To format your code, fence it between a set of three tildes: ~~~



Your code here


Thanks and thanks.

This page on the wiki may be of help. (Update) I have also added this page to begin to document how the Codea forums work.