Advertisement
theoriginalbit

Loading API: Example — Lots of Bars

Jan 13th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. os.loadAPI( "/load")
  2.  
  3. local logo = {
  4.     "7   7              7     7        77 3   3 3  ",
  5.     "7   7                              7 3     3  ",
  6.     "777 777 777 777 77 7 777 7 777 777 7 333 3 333",
  7.     "7   7 7 7 7 7 7 7  7 7 7 7 7 7 7 7 7 3 3 3 3  ",
  8.     "7   7 7 777 7 7 7  7 777 7 7 7 777 7 3 3 3 3  ",
  9.     "7   7 7 7   7 7 7  7   7 7 7 7 7 7 7 3 3 3 3  ",
  10.     " 77 7 7 777 777 7  7 777 7 7 7 7 7 7 333 3  33",
  11. }
  12.  
  13. local bar1 = load.init( load.BAR_ONLY, nil, 20, 30, 12, colors.yellow, nil, nil, nil )
  14. local bar2 = load.init( load.BAR_ONLY, nil, 20, 15, 13, colors.yellow, nil, nil, nil )
  15. local bar3 = load.init( load.BAR_ONLY, nil, 20, 10, 14, colors.yellow, nil, nil, nil )
  16. local bar4 = load.init( load.BAR_ONLY, nil, 20, 5, 15, colors.yellow, nil, nil, nil )
  17.  
  18. local function dobarstuff()
  19.     for i = 1, 20 do
  20.         sleep( 0.3 ) -- normally something would be done here, please for the love of ___ don't just sleep it, this api isn't designed for fake loading screens
  21.         bar1:triggerUpdate( )
  22.         bar2:triggerUpdate( )
  23.         bar3:triggerUpdate( )
  24.         bar4:triggerUpdate( )
  25.     end
  26. end
  27.  
  28. local function dobar1()
  29.     bar1:run( )
  30. end
  31.  
  32. local function dobar2()
  33.     bar2:run( )
  34. end
  35.  
  36. local function dobar3()
  37.     bar3:run( )
  38. end
  39.  
  40. local function dobar4()
  41.     bar4:run( )
  42. end
  43.  
  44. parallel.waitForAll( dobar1, dobar2, dobar3, dobar4, dobarstuff )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement