term.setCursorBlink

From ComputerCraft
Jump to: navigation, search

term.setCursorBlink
Function
Syntax
term.setCursorBlink()
Returns nil
API term
Source CC:Tweaked (source)

Sets whether or not a blinking cursor should appear at the current cursor pos in the terminal object. When the cursor moves, the blinking cursor will move too, and it will continue to blink until it is manually turned off.

ExampleExampleToggle blinking cursor
Lets the user press enter to toggle whether or not the cursor is blinking.
Code
local blinking = false

print("Press enter to toggle whether or not the cursor is blinking.")
while true do
  local event, key = os.pullEvent("key")

  if key == keys.enter then
    blinking = not blinking -- Toggle blinking state.
    term.setCursorBlink(blinking)
    print("Blinking:", blinking)
  end
end
Output Demo term.setCursorBlink.gif