khoutuYaTaetsi
→ codeA string naming the **physical key** most recently pressed, whatever character it types.
khoutuYaTaetsitaetsi tells you which character was typed; khoutuYaTaetsi tells you which physical key on the keyboard was pressed.
The difference shows when SHIFT is held: pressing a with SHIFT gives taetsi === 'A' but khoutuYaTaetsi === 'KeyA'. The key is the same key; only the character changed.
It is also stable across keyboard layouts (QWERTY, AZERTY): the key physically labelled “A” always gives 'KeyA'.
Arrow keys have names too, like 'ArrowLeft', and Bopa’s constants such as MOLEMA_MOTSWI are exactly that string:
fa (khoutuYaTaetsi === MOLEMA_MOTSWI) { ... }
khoutuis attested Setswana for code: an error code is a khouto ya phoso. Bopa takes the more widely written spelling.
Examples
Section titled “Examples”diri mmatota = '';
diri letshwaoLone = '';
tiro setaLoeto() {
thalaKanefase(400, 220);
tlhalosa('Mela e mebedi ya mokwalo: taetsi ya mmatota le letshwao le e le kwadileng. Tobetsa setshwantsho pele.');
}
tiro tshwantsha() {
bokamorago(240);
tlatsaMmala(40, 60, 90);
bogoloJwaMokwalo(20);
rulaganyaMokwalo(BOGARE);
thalaMokwalo('khoutuYaTaetsi: ' + mmatota, 200, 95);
thalaMokwalo('taetsi: ' + letshwaoLone, 200, 130);
}
tiro taetsiETobeditswe() {
mmatota = khoutuYaTaetsi;
letshwaoLone = taetsi;
}