Difference between revisions of "Textutils (API)"
From ComputerCraft Wiki
m (Whoops, fixed grammar and spelling) |
Smiley43210 (Talk | contribs) m (Changed to use type template) |
||
Line 10: | Line 10: | ||
<tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | <tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.slowPrint]]( | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.slowPrint]]({{type|string}} text, {{type|int}} rate)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Slowly prints the text. Only difference is, it leaves a new-line after it.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Slowly prints the text. Only difference is, it leaves a new-line after it.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.slowWrite]]( | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.slowWrite]]({{type|string}} text, {{type|int}} rate)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Slowly writes the text.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Slowly writes the text.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.formatTime]]( | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.formatTime]]({{type|int}} time, {{type|boolean}} TwentyFourHour)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Put a time into it, and it spews it out in a different format. Example: print(textutils.formatTime(os.time(), false))</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Put a time into it, and it spews it out in a different format. Example: print(textutils.formatTime(os.time(), false))</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.tabulate]]( | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.tabulate]]({{type|table}} table, {{type|table}} table2, ...)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints tables in an ordered form. Each table is a row, the column(s)' width is auto-adjusted.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints tables in an ordered form. Each table is a row, the column(s)' width is auto-adjusted.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.pagedTabulate]]( | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.pagedTabulate]]({{type|table}} table, {{type|table}} table2, ...)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints tables in an ordered form, like [[textutils.tabulate]]. However, it waits for confirmation before scrolling down..</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints tables in an ordered form, like [[textutils.tabulate]]. However, it waits for confirmation before scrolling down..</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.pagedPrint]]( | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.pagedPrint]]({{type|string}} text, {{type|string}} confirmation_lines)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints string ''text'' onto the screen, but waits for confirmation before scrolling down.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Prints string ''text'' onto the screen, but waits for confirmation before scrolling down.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.serialize]]( | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.serialize]]({{type|table}} table)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a string representation of the table ''table'' for storage or transmission.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a string representation of the table ''table'' for storage or transmission.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.unserialize]]( | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.unserialize]]({{type|string}} text)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a table reassembled from the string ''text''.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a table reassembled from the string ''text''.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.urlEncode]]( | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[textutils.urlEncode]]({{type|string}} text)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">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].</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">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].</td></tr> | ||
</table> | </table> |
Revision as of 15:41, 2 May 2013
This page needs some serious TLC, stat! Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: Needs |
The Textutils API is used to format and manipulate strings easily.
Method Name | Description |
textutils.slowPrint(string text, int rate) | Slowly prints the text. Only difference is, it leaves a new-line after it. |
textutils.slowWrite(string text, int rate) | Slowly writes the text. |
textutils.formatTime(int time, boolean TwentyFourHour) | Put a time into it, and it spews it out in a different format. Example: print(textutils.formatTime(os.time(), false)) |
textutils.tabulate(table table, table table2, ...) | Prints tables in an ordered form. Each table is a row, the column(s)' width is auto-adjusted. |
textutils.pagedTabulate(table table, table table2, ...) | Prints tables in an ordered form, like textutils.tabulate. However, it waits for confirmation before scrolling down.. |
textutils.pagedPrint(string text, string confirmation_lines) | Prints string text onto the screen, but waits for confirmation before scrolling down. |
textutils.serialize(table table) | Returns a string representation of the table table for storage or transmission. |
textutils.unserialize(string text) | Returns a table reassembled from the string text. |
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]. |