Difference between revisions of "Textutils (API)"
From ComputerCraft Wiki
(Mild grammar fixes.) |
m (→Methods fix.) |
||
Line 6: | Line 6: | ||
!style="background:#EEE" width="*"|Description | !style="background:#EEE" width="*"|Description | ||
|- | |- | ||
− | |[[textutils.slowPrint|textutils.slowPrint( text , | + | |[[textutils.slowPrint|textutils.slowPrint]]([[string (type)|string]] text, [[number (type)|number]] rate) |
− | |Slowly prints the text. Only difference is, it leaves a line after it. | + | |Slowly prints the text. Only difference is, it leaves a new-line after it. |
|- | |- | ||
− | |[[textutils.slowWrite|textutils.slowWrite( text , | + | |[[textutils.slowWrite|textutils.slowWrite]]([[string (type)|string]] text, [[number (type)|number]] rate) |
|Slowly writes the text. | |Slowly writes the text. | ||
|- | |- | ||
− | |[[textutils.formatTime|textutils.formatTime( time, | + | |[[textutils.formatTime|textutils.formatTime]]([[number (type)|number]] time, [[boolean (type)|bool]] TwentyFourHour) |
|Put a time into it, and it spews it out in a different format. For example: | |Put a time into it, and it spews it out in a different format. For example: | ||
− | local | + | local time = os.time() |
− | print(textutils.formatTime( | + | print(textutils.formatTime(time, false)) |
|- | |- | ||
− | |[[textutils.tabulate|textutils.tabulate( table, | + | |[[textutils.tabulate|textutils.tabulate]]([[table (type)|table]] table, [[table (type)|table]] table2, ...) |
|Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted. | |Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted. | ||
|- | |- | ||
− | |[[textutils.pagedTabulate|textutils.pagedTabulate( table, | + | |[[textutils.pagedTabulate|textutils.pagedTabulate]]([[table (type)|table]] table, [[table (type)|table]]table2, ...) |
|<no description given> | |<no description given> | ||
|- | |- | ||
− | |[[textutils.pagedPrint|textutils.pagedPrint( string, | + | |[[textutils.pagedPrint|textutils.pagedPrint]]([[string (type)|string]] string, [[string (type)|string]] confirmation_lines) |
|Prints a string onto the screen, but waits for confirmation before scrolling down. | |Prints a string onto the screen, but waits for confirmation before scrolling down. | ||
|- | |- | ||
− | |[[textutils.serialize|textutils.serialize( | + | |[[textutils.serialize|textutils.serialize]]([[table (type)|table]] table) |
|Returns a string representation of the table t for storage or transmission. | |Returns a string representation of the table t for storage or transmission. | ||
|- | |- | ||
− | |[[textutils.unserialize|textutils.unserialize( | + | |[[textutils.unserialize|textutils.unserialize]]([[string (type)|string]] text) |
|Returns a table reassembled from the string s. | |Returns a table reassembled from the string s. | ||
|- | |- | ||
− | |[[textutils.urlEncode|textutils.urlEncode( | + | |[[textutils.urlEncode|textutils.urlEncode]]([[string (type)|string]] text) |
|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]. | |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 09:13, 25 November 2012
Text utilities is used to mess around with text easier.
Its functions include:
Method name | Description |
---|---|
textutils.slowPrint(string text, number rate) | Slowly prints the text. Only difference is, it leaves a new-line after it. |
textutils.slowWrite(string text, number rate) | Slowly writes the text. |
textutils.formatTime(number time, bool TwentyFourHour) | Put a time into it, and it spews it out in a different format. For example:
local time = os.time() print(textutils.formatTime(time, false)) |
textutils.tabulate(table table, table table2, ...) | Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted. |
textutils.pagedTabulate(table table, tabletable2, ...) | <no description given> |
textutils.pagedPrint(string string, string confirmation_lines) | Prints a string onto the screen, but waits for confirmation before scrolling down. |
textutils.serialize(table table) | Returns a string representation of the table t for storage or transmission. |
textutils.unserialize(string text) | Returns a table reassembled from the string s. |
textutils.urlEncode(string text) | 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]. |