1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-13 16:56:49 +00:00
CC-Tweaked/src/main/resources/data/computercraft/lua/rom/help/events.txt
SquidDev 5e462adc5c Relocate all resource files
- textures/{block,item}s -> textures/{block,item}
 - assets/*/{advancements,lua,recipes} -> data/*/...
2019-04-02 13:18:43 +01:00

16 lines
1.1 KiB
Plaintext

The function os.pullEvent() will yield the program until a system event occurs. The first return value is the event name, followed by any arguments.
Some events which can occur are:
"char" when text is typed on the keyboard. Argument is the character typed.
"key" when a key is pressed on the keyboard. Arguments are the keycode and whether the key is a repeat. Compare the keycode to the values in keys API to see which key was pressed.
"key_up" when a key is released on the keyboard. Argument is the numerical keycode. Compare to the values in keys API to see which key was released.
"paste" when text is pasted from the users keyboard. Argument is the line of text pasted.
Events only on advanced computers:
"mouse_click" when a user clicks the mouse. Arguments are button, xPos, yPos.
"mouse_drag" when a user moves the mouse when held. Arguments are button, xPos, yPos.
"mouse_up" when a user releases the mouse button. Arguments are button, xPos, yPos.
"mouse_scroll" when a user uses the scrollwheel on the mouse. Arguments are direction, xPos, yPos.
Other APIs and peripherals will emit their own events. See their respective help pages for details.