Difference between revisions of "Keymon"
From OpenEUO
(Created page with "== Calling Pattern == Call local km = sl.keymon(t) Args t is a table Results km is a key monitor closure == Closure Methods == * keymon.refresh == Example == local t...") |
m |
||
Line 35: | Line 35: | ||
Use keymon to generate a hotkey processing engine. The sole argument to keymon is a table whose keys are strings made up of hotkey combinations (separated by spaces) and whose values are the associated functions to call. A keymon closure exposes one method, [[keymon.refresh|refresh]], which will scan all the possible keys necessary to check all of the hotkey combinations, determine which combo, if any, has been pressed, and invokes the associated handler. | Use keymon to generate a hotkey processing engine. The sole argument to keymon is a table whose keys are strings made up of hotkey combinations (separated by spaces) and whose values are the associated functions to call. A keymon closure exposes one method, [[keymon.refresh|refresh]], which will scan all the possible keys necessary to check all of the hotkey combinations, determine which combo, if any, has been pressed, and invokes the associated handler. | ||
− | See [[keymon.refresh]] for further operational details. | + | Hotkeys are specified by the same strings that are available to [[getkey]]. See [[keymon.refresh]] for further operational details. |
== Upon Error == | == Upon Error == | ||
Line 44: | Line 44: | ||
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | * [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | ||
+ | |||
+ | * [[getkey]] | ||
* [[journal]] | * [[journal]] |
Latest revision as of 16:18, 8 January 2011
Calling Pattern
Call
local km = sl.keymon(t)
Args
t is a table
Results
km is a key monitor closure
Closure Methods
Example
local t = { ['ALT SHIFT J']= function() print('ALT SHIFT J') end, ['CTRL J'] = function() print('CTRL J') end, ['Q W'] = function() print('Q W') end, } local km = sl.keymon(t) while true do km.refresh() wait(30) end
-> ALT SHIFT J ALT SHIFT J CTRL J ALT SHIFT J Q W Q W
Description
Use keymon to generate a hotkey processing engine. The sole argument to keymon is a table whose keys are strings made up of hotkey combinations (separated by spaces) and whose values are the associated functions to call. A keymon closure exposes one method, refresh, which will scan all the possible keys necessary to check all of the hotkey combinations, determine which combo, if any, has been pressed, and invokes the associated handler.
Hotkeys are specified by the same strings that are available to getkey. See keymon.refresh for further operational details.
Upon Error
If keymon receives no parameter or if the provided parameter is not a table, keymon issues an error to be handled according to the operant error reporting mode.