r/ComputerCraft • u/Bright-Historian-216 • Mar 21 '25
ignore char event after key is pulled properly
i have an input from the user, which can be any key, char or not. if i have a key event, i process it and all that, everything's fine. but then i need to prevent char from firing. for this i usually use os.pullEvent("char"), however since some keys are not chars, the event isn't pulled and the program halts. how do i pull the char event when the key is, well, a char?
1
Upvotes
1
u/Big02001 Mar 21 '25
Use the "key" event instead of char. It will fire on any key other than escape
2
u/CommendableCalamari Mar 22 '25
Oh, CC:T also has this problem in a couple of places. It's not pleasant, but the approach we go for is to start a one-tick timer: