- Loading the Console Progress Bar Library
- Usage example
- Available styles
- Create your own style
- Supported methods
The Console Progress Bar library is optional. In order to use this library, you must require it in one of your source files (preferably main.lua) prior to use. It only needs to be required once in a single file. It is recommended you do this at the top of your main.lua file, outside of any functions or other code, and you may do this by using this code:
The above example will work well enough. Consider what would happen if each file look longer than 100ms to process. The bar would only update after each file finished processing, which may be a second or more. As a result, the animation would look terrible!
To improve the animation in these types of scenarios, we could chunk the processing up further and update the bar with every chunk. This will cause the progress bar to animate much more smoothly, even between files finishing their processing.
Style | Description | Options |
---|---|---|
The default progress bar style. | character - a single character to use. Default: # | |
The fallback style for limited ANSI supported machines | ||
A solid bar with configurable color (RGB) |
r - The red channel. Default: 64g - The green channel. Default: 255b - The blue channel. Default: 64 |
|
A solid yellow bar that turns green when completed | ||
A rainbow bar with configurable saturation and animation |
saturation - Color saturation level between 0 (grayscale) and 1 (full color). A value of 0.5 would give a pastel rainbow. Default: 1.0animSpeed - Should be a number. If given, scrolls the rainbow bar left (negitive values) or right (positive values). Default: |
|
An animated bar simulating ocean waves rolling in and out. | speed - Default: 1.0 |