-
Notifications
You must be signed in to change notification settings - Fork 9
fText: TextFormatter
The TextFormatter provides a reusable and adjustable way to format your text. It's like a demonnic:fText() you can take with you.
It also provides a bit more type checking for some things. The other major difference is it defaults to formatType = c
rather than uncolored, as I've found this to be the more common use case.
The uncolored default was kept for cfText/align largely for historical reasons.
All of a TextFormatter's options can be adjusted/viewed via the options table.
So if you make the formatter like testFormatter = demonnic.TextFormatter:new()
then you can set and access the options table via testFormatter.options
.
However, where possible it is recommended that you use the set functions, as they provide more error handling and type checking.
If you really know what you're doing and just want to change an option without the overhead of type checking and the like though, testFormatter.option.wrap = true
would set the formatter's wrap option to true, etc.
options is a table of formatting options. Please see the API docs for a full list of options and the methods for interacting with them.
formatType
defaults to c
rather than ""
Returns a string, formatted according to the formatter options being held by the TextFormatter
fText: TextFormatter: Examples should help you get started.