ComputerCraft Forums

General => Wiki Discussion => Topic started by: Luca_S on Apr 24, 2019, 05:47 PM

Title: Keys API and constants
Post by: Luca_S on Apr 24, 2019, 05:47 PM
I'm not quite sure how the keys API should be documented.

While the Keys API itself definitely needs a page the question is what to do about all the keys constants. The constants template would get cluttered with all the keys constant and we would get more than 100 pages just containing something like "keys.a is the keycode of the a key" if each constant did get its own page.

What is your opinion on this?
Title: Keys API and constants
Post by: Lupus590 on Apr 24, 2019, 07:08 PM
Could you summerise the alpha-numeric keys as appearing in the API as they are displayed on the screen/keyboard?

That way you just have to document the other ones.
Title: Keys API and constants
Post by: Lignum on Apr 25, 2019, 07:25 PM
I think the table seen here (https://github.com/SquidDev-CC/CC-Tweaked/blob/master/src/main/resources/assets/computercraft/lua/rom/apis/keys.lua) should serve as inspiration. Have header columns be the least significant digit of the scancode, and the rows the rest of the digits.

Additionally, it's worth mentioning that these scancodes are the same ones used by LWJGL 2 (http://legacy.lwjgl.org/).
Title: Keys API and constants
Post by: QuickMuffin8782 on Aug 18, 2020, 02:32 PM
Quote from: Lignum on Apr 25, 2019, 07:25 PM-snip-
I know this was posted a long time ago, but to add, here is a image showing the keys on the keyboard, it should help you with getting the keys mastered with lua.
(https://camo.tmpim.com/2c1b3e4e9072a45a1f6e690e3f23547191817988/68747470733a2f2f64726976652e676f6f676c652e636f6d2f75633f6578706f72743d646f776e6c6f616426616d703b69643d3142307234794e4879562d3464576f626b47566766706271646f442d6353667373)
PS: 216 is the Command/Windows Key