window.create

From ComputerCraft Wiki
Revision as of 12:11, 6 April 2014 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=window.create |args={{type|table}} parentTerm, {{type|number}} x, {{type|number}} y, {{type|number}} width, {{type|number}} height [<nowiki/>, {...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Grid Redstone.png  Function window.create
Returns a terminal object that is a space within the specified parent terminal object. This can then be used (or even redirected to) in the same manner as eg a wrapped monitor. Refer to the term API for a list of functions available to it.

term itself may not be passed as the parent, though term.native() is acceptable. Generally, term.current() or a wrapped monitor will be most suitable, though windows may even have other windows assigned as their parents.
Syntax window.create(table parentTerm, number x, number y, number width, number height [, boolean visible])
Returns table terminal object
Part of ComputerCraft
API window

Examples

Grid paper.png  Example
Defines a 20x10 window within the current terminal display at x15/y5, then fills it with white.
Code
local myWindow = window.create(term.current(),15,5,20,10)

myWindow.setBackgroundColor(colours.white)
myWindow.clear()