Thanks garry23, that was great advice

Though also this technique I'm not quite out of the woods yet.
With below example I get funky results when I keep basing the PLAY for a while.
E.g. if I press it quickly, maybe 40 times, the camera locks up for some time.
When it responds again it often shows me, in the playback mode, a photo I've taken.
Clearly the intention of the script is to not allow default action of the keys.
Yet still a key event slipped through.
While this may be extreme usage it shows it's not robust.
With my more complex script the issues and lockups are worse, also with less key pressing.
-- Double Press
-- Working kind of
first_press_time = nil
second_press_time = nil
event.shoot_task = function()
if(first_press_time == nil) then
return true
end
-- If after 500ms no second key is pressed
-- Don't wait and handle first key press
if(dryos.ms_clock - first_press_time) > 500 then
display.notify_box("Single")
first_press_time = nil
return true
end
if(second_press_time ~= nil) then
-- This is a double press
first_press_time = nil
second_press_time = nil
display.notify_box("Double")
lv.pause()
lv.start()
end
return true
end
event.keypress = function(k)
if(first_press_time == nil) then
first_press_time = dryos.ms_clock
else
second_press_time = dryos.ms_clock
end
-- Don't respond to any keys
return false
end