tapKey r
does not care to tap a key (/keyid). It just adds a scancode into a USB report. (Yes, it is a misnomer.)
Also, let me remind you that dynamic memory is quite a scarce resource in UHK, and dealing with tables of names of variable length is problematic.
I am also not clear on whether you want to apply this mapping to char/KEYABBREV
↔ scancode mapping or to name ↔ KEYID mapping, since the original thread was about keyids, not scancodes.
Assume a keymap that has all keys bound to the x scancode, and just one key with a macro that contains a train of
ifGesture 1 tapKey a
ifGesture 2 tapKey b
...
If you are truly speaking about keyid ↔ symbol mapping, how would you replace the 1, 2, … keyids in the above example?