Window API

From ComputerCraft
Jump to: navigation, search
FunctionFunctionwindow.create
Create a new Window Object.
Syntax window.create()
Returns table window
Part of CC:Tweaked (source)
API window
ExampleExampleCreate a Window
Create a Window
Code
local win = window.create(term.current(),1,1,10,10)
win.write("Hello World")


FunctionFunctionwindow.getPosition
Returns the Position of a Window.
Syntax window.getPosition()
Returns number x number y
Part of CC:Tweaked (source)
API window
ExampleExampleGet the Position of a Window
Get the Position of a Window and print it.
Code
local win = window.create(term.current(),1,1,10,10)
print(win.getPosition())
Output
1 1


FunctionFunctionwindow.redraw
Redraw a Window.
Syntax window.redraw()
Part of CC:Tweaked (source)
API window
ExampleExampleRedraw a Window
Redraw a Window
Code
local win = window.create(term.current(),1,1,10,10)
win.redraw()


FunctionFunctionwindow.reposition
Moves and optional resizes a window.
Syntax window.reposition()
Returns nil
Part of CC:Tweaked (source)
API window
ExampleExampleMove a Window
Move a Window
Code
local win = window.create(term.current(),1,1,10,10)
win.reposition(5,5)


FunctionFunctionwindow.restoreCursor
Returns the Cursor back to a Window.
Syntax window.restoreCursor()
Returns nil
Part of CC:Tweaked (source)
API window
ExampleExampleRestore the Cursor
Restore the Cursor
Code
local win = window.create(term.current(),1,1,10,10)
win.restoreCursor()


FunctionFunctionwindow.setVisible
Change the visibility of a window.
Syntax window.setVisible()
Returns nil
Part of CC:Tweaked (source)
API window
ExampleExampleHide a Window
Hide a Window
Code
local win = window.create(term.current(),1,1,10,10)
win.write("This Text will disappear in 5 seconds")
sleep(5)
win.setVisible(false)