decode_modifiers - Convert a modifier-bitmap to a textual representation.
modtbl or modstr
decode_modifiers( modval, separator )
The input table that is provided as part of the _input event handler has a
modifiers field that is a bitmap of different modifier states. This bitmap can
be converted to either an integer indexed table of text representations of
each present modifier, or as a single concatenated string with the character
in separator added between the individual modifiers. If the
separator argument is provided, and is a non-empty string, then
modstr will be returned. Otherwise modtbl will be returned. The
different possible text representations of the modifiers are:
"lshift", "rshift", "lalt", "ralt",
"lctrl", "rctrl", "lmeta", "rmeta",
"num", "caps", "mode"
- 1
- If the separator is an empty string, the '_' character will be used as
separator instead.
- 2
- There is also a modifier bit to indicate if the event was a repeat (if the
input platform supports that). This will not be added to the decoded
output as it would subtly break a lot of 'naive' approaches to
keybindings.
function decode_modifiers0()
print( table.concat(decode_modifiers( 0xffffff ), "0) );
print( decode_modifiers(0xffffff, "_") );
end