Difference between revisions of "Textutils.tabulate"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "{{lowercase}} {{Function |name=textutils.tabulate |args= table table, table table, ... |returns=Text printed on the screen |api=textutils |ad...")
 
(Updated/Improved)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=textutils.tabulate
 
|name=textutils.tabulate
|args= [[table (type)|table]] table, [[table (type)|table]] table, ...
+
|args={{type|table}} table/{{type|number}} color, {{type|table}} table2/{{type|number}} color2, ...
|returns=Text printed on the screen
+
|returns={{type|nil}}
 
|api=textutils
 
|api=textutils
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted.
+
|desc=Prints tables in an ordered form. Each table is a row, the column width is auto-adjusted. If it encounters a number instead of a table then sets the text color to it. If the data to print exceeds that which can fit on the display, unlike [[textutils.pagedTabulate]](), this does not wait before scrolling excess text out the top.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc=Prints two tables in an ordered form.
 
|desc=Prints two tables in an ordered form.
|code=textutils.tabulate({1,2,3},{"A","B","C"})
+
|code='''textutils.tabulate( [[colors_(API)|colors]].orange, {1,2,3}, [[colors_(API)|colors]].lightBlue, {"A","B","C"} )'''
|output=Print:
+
|output=Prints:
1.0 2.0 3.0
+
<span style="color:#F2B233">1.0   2.0   3.0</span>
 
+
<span style="color:#99B2F2">A     B     C</span>
A   B   C
+
&nbsp;
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Latest revision as of 20:58, 16 February 2015


Grid Redstone.png  Function textutils.tabulate
Prints tables in an ordered form. Each table is a row, the column width is auto-adjusted. If it encounters a number instead of a table then sets the text color to it. If the data to print exceeds that which can fit on the display, unlike textutils.pagedTabulate(), this does not wait before scrolling excess text out the top.
Syntax textutils.tabulate(table table/number color, table table2/number color2, ...)
Returns nil
Part of ComputerCraft
API textutils

Examples

Grid paper.png  Example
Prints two tables in an ordered form.
Code
textutils.tabulate( colors.orange, {1,2,3}, colors.lightBlue, {"A","B","C"} )
Output Prints:
1.0   2.0   3.0
A     B     C