Handled flag?

Announcements, questions
Post Reply
MrAndreas
Posts: 6
Joined: 12 Apr 2017, 02:37

Handled flag?

Post by MrAndreas » 12 Apr 2017, 04:29

Is there any way of telling the callback that the current button/direction wasn't handled by the handler so that the button/direction doesn't get trapped but passed on? The way I'm handling it so far is as follows, but this does ignore direction and doesn't send the original button but the ASCII code of it.

lmc_set_handler('FootSwitch',function(button, direction)
_handled = 0

-- Optional code here (sets _handled to 1 if handled)

if (_handled == 0) then
print("Unassigned key: " .. button)
--lmc_send_keys(button, direction) -- Convert code to ASCII or, better still, just return the button/direction combination as unhandled!!!
end
end)

Would be nice if there was an optional flag handled that was part of function, i.e., function(button, direction, var handled = 1) defaulting to 1 to remain backwards compatible.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Handled flag?

Post by admin » 12 Apr 2017, 07:50

There is no way.
Blocking original key is kind of windows hack when message queue for active process is in fact stopped until LuaMacros tells whether key should be passed or not. So far it's decided only by macro presence so queue is unblocked quite quickly and LUA code is executed afterwards.
I don't want to move this responsibility (possibility to block active app) to LUA code which can contain anything..
Petr Medek
LUAmacros author

Post Reply