Difference between revisions of "Textutils (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Mild grammar fixes.)
Line 25: Line 25:
 
|-
 
|-
 
|[[textutils.pagedPrint|textutils.pagedPrint( string, lines-to-print-before-confirmation )]]
 
|[[textutils.pagedPrint|textutils.pagedPrint( string, lines-to-print-before-confirmation )]]
|Prints a string onto the screen, but waiting for confirmation before scrolling down.
+
|Prints a string onto the screen, but waits for confirmation before scrolling down.
 
|-
 
|-
 
|[[textutils.serialize|textutils.serialize( t )]]
 
|[[textutils.serialize|textutils.serialize( t )]]
Line 34: Line 34:
 
|-
 
|-
 
|[[textutils.urlEncode|textutils.urlEncode( str )]]
 
|[[textutils.urlEncode|textutils.urlEncode( str )]]
|Makes a string safe to encode into an url. Spaces are replaced with +s. Unsafe characters such as '\', '£' and '}' are translated into ASCII code and preceeded with a % for transmission. For reference visit: [http://www.blooberry.com/indexdot/html/topics/urlencoding.htm].
+
|Makes a string safe to encode into a url. Spaces are replaced with +s. Unsafe characters such as '\', '£' and '}' are translated into ASCII code and preceded with a % for transmission. For reference visit: [http://www.blooberry.com/indexdot/html/topics/urlencoding.htm].
 
|}
 
|}
  
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 10:26, 31 October 2012

Text utilities is used to mess around with text easier.

Its functions include:

Method name Description
textutils.slowPrint( text , nRate) Slowly prints the text. Only difference is, it leaves a line after it.
textutils.slowWrite( text , nRate) Slowly writes the text.
textutils.formatTime( time, bTwentyFourHour) Put a time into it, and it spews it out in a different format. For example:

local nTime = os.time()

print(textutils.formatTime( nTime, false ))

textutils.tabulate( table, table2, so on) Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted.
textutils.pagedTabulate( table, table2, so on) <no description given>
textutils.pagedPrint( string, lines-to-print-before-confirmation ) Prints a string onto the screen, but waits for confirmation before scrolling down.
textutils.serialize( t ) Returns a string representation of the table t for storage or transmission.
textutils.unserialize( s ) Returns a table reassembled from the string s.
textutils.urlEncode( str ) Makes a string safe to encode into a url. Spaces are replaced with +s. Unsafe characters such as '\', '£' and '}' are translated into ASCII code and preceded with a % for transmission. For reference visit: [1].