This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
deeredman1991's profile picture

Make a "Keys" API

Started by deeredman1991, 04 April 2015 - 02:59 AM
deeredman1991 #1
Posted 04 April 2015 - 04:59 AM
It probably been done before, but I made it so I figured I would post it.

This is basically an API that assigns key codes to a variable named after the letter the key code references.

for example if you want to do

local event, param1, param2, param3 = os.pullEvent()

if event == "key" then
if param1 == 17 then
print(" 'w' was pressed")
end
end


you could instead do


if param1 == k.w then


here is the pastebin. :)/>
Bomb Bloke #2
Posted 04 April 2015 - 05:04 AM
It's been done, but good effort. :)/>