Progress Bar
The Progress Bar is a Lua function that can create a moving progress bar on the screens.
There are several Lua functions that are connected to creating and running a progress bar. See links to the topics below the example.
Example
Section titled âExampleâThis example uses all the progress bar functions:
| Copy CodeLua |
| ``` |
| return function() |
-- create the progress barlocal progressBarHandle = StartProgress("myProgressTitle")
-- set start index and end index of the progress barlocal progressRangeStart, progressRangeEnd = 1, 10
-- Define the range of the progress barSetProgressRange(progressBarHandle, progressRangeStart, progressRangeEnd)-- Define the text of the progress barSetProgressText(progressBarHandle, "This is my ProgressBar Text")-- Set the progress bar value to the start of rangeSetProgress(progressBarHandle, progressRangeStart)
-- Loop that goes through the progress barfor i = progressRangeStart, progressRangeEnd do -- Add a yield to allow other functions and delay the progress coroutine.yield(1) -- Increment the progress state of the progress bar IncProgress(progressBarHandle, 1)end
-- remove the progress bar:StopProgress(progressBarHandle)end
### Related Functions
- [StartProgress](/grandma3/2-4/lua_objectfree_startprogress/)- [SetProgressRange](/grandma3/2-4/lua_objectfree_setprogressrange/)- [SetProgress](/grandma3/2-4/lua_objectfree_setprogress/)- [SetProgressText](/grandma3/2-4/lua_objectfree_setprogresstext/)- [IncProgress](/grandma3/2-4/lua_objectfree_incprogress/)- [StopProgress](/grandma3/2-4/lua_objectfree_stopprogress/)