December 15, 2019, 11:32:14 am

News:

Juju thinks he's so clever by putting funny stuff here


The shoutbox is currently out of service. Join us on Discord instead.
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?
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...

DJ 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.

Adriweb

December 01, 2015, 05:39:37 am #3 Last Edit: December 01, 2015, 05:41:47 am by Adriweb
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.
Co-founder & co-administrator of TI-Planet and Inspired-Lua

DJ 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.

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
My cemetech username is awesommee333.

SiphonicSugar

Thanks for the help, I will probably use this topic to ask more Lua questions later.
I'm just trying to grab some inspiration. :P

DJ 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!

Powered by EzPortal