decode_modifiers(3)
π decode_modifiers(3) π
okay bestie, so this one lives in the Arcan Lua API and it's genuinely such a slay little helper π
β¨ NAME β¨
decode_modifiers β turns a modifier-bitmap into a textual representation. literally converting keyboard-modifier soup into words you can actually read π₯
πΈ SYNOPSIS πΈ
modtbl or modstr
decode_modifiers( modval, separator )
π DESCRIPTION π
so the input table you get handed as part of the _input event handler has a modifiers field, right? and that field is a bitmap of all the different modifier states currently vibing. this function takes that bitmap and converts it into one of two things, depending on what you ask for:
- an integer-indexed table of text representations β one entry per modifier that's actually present, or
- a single concatenated string, with whatever character you passed in
separatordropped between the individual modifiers.
here's the vibe check on which one you get: if the separator argument is provided and it's a non-empty string, then you get modstr back π«Ά. otherwise? you get modtbl. no cap, that's the whole rule.
the possible text representations of the modifiers are:
"lshift", "rshift", "lalt", "ralt", "lctrl", "rctrl", "lmeta", "rmeta", "num", "caps", "mode"
that's the full roster, icon behavior only β¨
π¦ NOTES π¦
- if the
separatoris an empty string, the'_'character will be used as the separator instead. sneaky little default, but okay π - there's also a modifier bit to indicate whether the event was a repeat (only if the input platform supports that, iykyk). this one will not be added to the decoded output, because it would subtly break a lot of 'naive' approaches to keybindings. so like, it's on purpose. do not come for it π
π EXAMPLE π
function decode_modifiers0()
print( table.concat(decode_modifiers( 0xffffff ), "0) );
print( decode_modifiers(0xffffff, "_") );
end
π sign-off π
that's the whole page, bestie β shipped under system, dated October 2026. go forth and decode those modifiers, main character π§π
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms