Starting to learn mesh

This is what I have so far


-- hexagon grid test
-- mesh testing 2

supportedOrientations(LANDSCAPE_ANY)

function setup()
    X={}    -- x coord table
    Y={}    -- y coord table
    s=30    -- size of hex 30 is finger size
    cx=374    -- start position of x
    cy=384    -- start position of y
    for i = 1,6 do
        angle = 2 * math.pi/ 6 * i
        xx = cx + s * math.cos(angle)
        table.insert(X,xx)
        yy = cy + s * math.sin(angle)
        table.insert(Y,yy)
    end

    myMesh = mesh()
    myMesh.vertices = 
    {vec2(cx,cy),vec2(X[1],Y[1]),vec2(X[2],Y[2]),
    vec2(cx,cy),vec2(X[2],Y[2]),vec2(X[3],Y[3]),
    vec2(cx,cy),vec2(X[3],Y[3]),vec2(X[4],Y[4]),
    vec2(cx,cy),vec2(X[4],Y[4]),vec2(X[5],Y[5]),
    vec2(cx,cy),vec2(X[5],Y[5]),vec2(X[6],Y[6]),
    vec2(cx,cy),vec2(X[6],Y[6]),vec2(X[1],Y[1])}
    
end

function draw()
    background(56, 56, 64, 255)
    myMesh:draw()
end


Any ideas how I would alter the code to allow me to generate 126 hexes in an array.

Thanks

@Jazmal See this link. I show a simple program that uses the triangulate function to create different meshes. Slide your finger up or down the screen to change the number of outside edges.

http://twolivesleft.com/Codea/Talk/discussion/comment/36460