Problem assigning value using Signal

I’m using hump.Signal, and I’m having trouble assigning the value received from the message to a local property:

Signal.register('onButtonClick', function( info )
    currentInfo = info
end)


local currentInfo = {}  --<< Stays empty!

local function showInfo(parent)
   local nameText = display.newText( {
    parent = parent,
    text = currentInfo.name,  --<< Error here!!
    x = _CX,
    y = _CY ,
   } )
end

function scene:create( event )
    local sceneGroup = self.view

    showInfo(sceneGroup)

end

What is the proper way to achieve this?

Move currentInfo before your register call, so that the function can see it. Otherwise it’s just assuming to a global value and the local version is hiding it.

Still not working. I think it has to do with the scene’s life cycle. I moved the function call inside scene:show- phase == "did" instead of scene:create and it worked.