Join us on Discord!
You can help CodeWalrus stay online by donating here.

Lua Key Check (TI-Nspire)

Started by SiphonicSugar, December 01, 2015, 05:08:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SiphonicSugar

So, what would be some example of code that would check if I have pressed the tab button, and if I press tab, add 1 to x?
  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

Ivoah

Lua key presses work with callbacks. The on.tabKey function is called whenever the tab key is pressed, and on.arrowKey when an arrow key is pressed, etc...
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dream of Omnimaga

Isn't there a key map somewhere for Lua with the valid key names in code form? (eg tabKey) We have that for Axe and BASIC, although with numbers.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Adriweb

#3
Well, see the Nspire-Lua API PDF from TI or https://wiki.inspired-lua.org/Category:Events
on.charIn is probably what you want for non-arrow and non-special keys.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

Oh I meant a graphical key map, like this, not a list:



But thanks anyway. I'll also check the PDF later to see if it has a graphical key map.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

semiprocoder

Oh. Unfortunately as far as I know there is no keymap because they don't have a universal getkey command. There are just interrupts called that ld studios linked.

Also here is an example of a code that increments x when you press the tab button:

function on.tabKey()
   x=x+1
end
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

SiphonicSugar

Thanks for the help, I will probably use this topic to ask more Lua questions later.
  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

Dream of Omnimaga

Quote from: semiprocoder on December 01, 2015, 11:58:20 AM
Oh. Unfortunately as far as I know there is no keymap because they don't have a universal getkey command. There are just interrupts called that ld studios linked.

Also here is an example of a code that increments x when you press the tab button:

function on.tabKey()
   x=x+1
end

I see. Interesting. That's definitively something I would need to get used to if I learned Lua I guess, but again I don't plan to do TI-Nspire dev. Good luck SiphonicSugar!
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal