Module guih.lib.text
Api used for manipulating text and strings.
similiar to cc.strings but better.
Functions
wrap (text, width[, mode]) | wraps the text with a set maximum width. |
cut_parts (text, width) | cuts string into sizes of variable width |
ensure_size (text, width) | ensures a width of a string |
Functions
- wrap (text, width[, mode])
-
wraps the text with a set maximum width.
Parameters:
- text string the text to wrap
- width number the maximum width of the text
- mode boolean whether should the text be returned as a table of strings instead of a single string with newlines (optional)
Returns:
-
string
the newline wrapped text
- cut_parts (text, width)
-
cuts string into sizes of variable width
Parameters:
- text string the text to cut
- width number the maximum width of the text
Returns:
-
table
the cut up parts of the string
- ensure_size (text, width)
-
ensures a width of a string
Parameters:
- text string the text to ensure the width of
- width number the maximum/minimum width of the text
Returns:
-
string
the new string with the width ensured to be the inputed width