mouse_scroll event

 Note: This event is only called on advanced terms, such as an Advanced Computer, Advanced Pocket Computer or Neural Interface.

ExamplePrint coordinates
Prints the scroll direction and mouse coordinates every time the user scrolled.
local scroll_directions = { [-1] = "up", [1] = "down" }

while true do
  local event, direction, x, y = os.pullEvent("mouse_scroll")
  print("The mousewheel scrolled", scroll_directions[direction], "at", x, ",", y)
  • direction : number The direction that was being scrolled in. -1 is up and 1 is down.
  • x : number The X position of the mouse in the term
  • y : number The Y position of the mouse in the term

Source CC:Tweaked

Occurs every time a mousewheel scrolls.

This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.