Lua Key Press question

Started by garry23, March 04, 2016, 09:11:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

David  :)

I have this simple test script: but it doesn't respond as I would expect:

event.keypress = function(key)
if key == KEY.PLAY then
display.notify_box (key,3000)
return false
else
return true
end
end


I would expect the notify to display only if PLAY is pressed, ie value 24; and play is not enacted by Canon, ie return false.

What seems to happen is notify is called every time a key is pressed.

Any hints what I'm missing?

garry23

David

Sorry, still getting confused.

Why does this create errors?

event.keypress = function(key)
if key == KEY.PLAY then
key.press(KEY.PLAY)
return false
else
return true
end
end

dmilligan

I'm surprised it doesn't lock up the camera. Theoretically you've set up an infinite loop.

garry23

Of course: how stupid of me.

The Lua key.press will call the event handler, that's running!!!

I was trying to see if I could use Lua to reprogram functionality to the PLAY key.

My thought was to reprogam PLAY to operate like the ETTR SET, which, unfortunately is not in the ML EOS-M version.

Once again, thanks for the (obvious  :-[) pointer.