
local numSelected = 0
local counter = 10

-- Handler de eventos
function onKeyPress(evt)
        if evt.class == 'key' and evt.type == 'press' then
           numSelected = numSelected + 1
           print(numSelected)
        end
        return true 
end

function gameTimer()
  if counter > 0 then
    event.timer(1000, gameTimer);
    counter = counter - 1
  else 
    event.post('out',{class = "ncl", type = "attribution", name = 'flagEnd', action='start', value=1})
    event.post('out',{class = "ncl", type = "attribution", name = 'flagEnd', action='stop', value=1})
  end

end

gameTimer()
event.register(onKeyPress)