Anonymous

Module:StringBuilder/doc: Difference between revisions

From Melvor Idle
Undo revision 67384 by Ricewind (talk)
No edit summary
(Undo revision 67384 by Ricewind (talk))
Tag: Undo
Line 1: Line 1:
==StringBuilder Module Documentation ==
== `StringBuilder` Module Documentation ==


The <code>StringBuilder</code> module provides functionality to efficiently build and manipulate strings in Lua.
The `StringBuilder` module provides functionality to efficiently build and manipulate strings in Lua.


=== Constructor ===
=== Constructor ===


'''<code>StringBuilder.new()</code>'''
'''`StringBuilder.new()`'''


Creates a new <code>StringBuilder</code> object.
Creates a new `StringBuilder` object.


* '''Returns:''' <code>StringBuilder</code> object.
* '''Returns:''' `StringBuilder` object.


=== Methods ===
=== Methods ===


'''<code>StringBuilder:append(...)</code>'''
'''`StringBuilder:append(...)`'''


Appends strings or values to the <code>StringBuilder</code> buffer.
Appends strings or values to the `StringBuilder` buffer.


* '''Parameters:'''
* '''Parameters:'''
   * '...': One or more values to append to the buffer.
   * `...`: One or more values to append to the buffer.


'''<code>StringBuilder:appendLine(...)</code>'''
'''`StringBuilder:appendLine(...)`'''


Appends strings or values followed by a newline (<code>\n</code>) to the <code>StringBuilder</code> buffer.
Appends strings or values followed by a newline (`\n`) to the `StringBuilder` buffer.


* '''Parameters:'''
* '''Parameters:'''
   * '...': One or more values to append to the buffer.
   * `...`: One or more values to append to the buffer.


'''<code>StringBuilder:clear()</code>'''
'''`StringBuilder:clear()`'''


Clears the contents of the <code>StringBuilder</code> buffer.
Clears the contents of the `StringBuilder` buffer.


* '''Usage:''' Call this method to reset the <code>StringBuilder</code> buffer to an empty state.
* '''Usage:''' Call this method to reset the `StringBuilder` buffer to an empty state.


'''<code>StringBuilder:toString()</code>'''
'''`StringBuilder:toString()`'''


Converts the <code>StringBuilder</code> buffer into a concatenated string.
Converts the `StringBuilder` buffer into a concatenated string.


* '''Returns:''' Concatenated string representation of the <code>StringBuilder</code> buffer.
* '''Returns:''' Concatenated string representation of the `StringBuilder` buffer.


=== Example Usage ===
=== Example Usage ===


To use the <code>StringBuilder</code> module in your Lua scripts, follow these examples:
To use the `StringBuilder` module in your Lua scripts, follow these examples:
 


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
2,875

edits