glNode. How to get points/vertices?

Hello everybody.
I have the following code:

local glNode  = cc.GLNode:create()
glNode:setContentSize(cc.size(100, 100))
glNode:setAnchorPoint(cc.p(0.5, 0.5))
glNode:setPosition(160,640)
local function primitivesDraw(transform, transformUpdated)       
    kmGLPushMatrix()
    kmGLLoadMatrix(transform)
    local yellowPoints = { cc.p(0,0), cc.p(100,0), cc.p(50,90), cc.p(10,100), cc.p(50,100)}
    cc.DrawPrimitives.drawColor4B(255,0,0,255) 
    cc.DrawPrimitives.drawSolidPoly(yellowPoints,4,cc.c4f(0.5, 0.5, 1, 0.5))
    gl.lineWidth( 5.0 )
    kmGLPopMatrix()
end

glNode:registerScriptDrawHandler(primitivesDraw)
self:getResourceNode():addChild(glNode)

This code draws some polygon. What I want is to access the points of glNode (yellowPoints) from the outside. In terms of pseudocode I would like something like that to access the x coordinate of the first point:

  glNode:getPoints()[1].x

Is there a way to do this?

I myself found a way to do this.
I put the declaration of yellowPoints outside of the function

local glNode  = cc.GLNode:create()
glNode:setContentSize(cc.size(100, 100))
glNode:setAnchorPoint(cc.p(0.5, 0.5))
glNode:setPosition(160,640)
local yellowPoints = { cc.p(0,0), cc.p(100,0), cc.p(50,90), cc.p(10,100), cc.p(50,100)}
local function primitivesDraw(transform, transformUpdated)       
    kmGLPushMatrix()
    kmGLLoadMatrix(transform)

    cc.DrawPrimitives.drawColor4B(255,0,0,255) 
    cc.DrawPrimitives.drawSolidPoly(yellowPoints,4,cc.c4f(0.5, 0.5, 1, 0.5))
    gl.lineWidth( 5.0 )
    kmGLPopMatrix()
end
glNode.points=yellowPoints
glNode:registerScriptDrawHandler(primitivesDraw)
self:getResourceNode():addChild(glNode)

Later I can access and update the points via glNode.points[1].x