Callback
love.run( )
The main function, containing the main loop. A sensible default is used when left out.
Synopsis
function love.run( )
    ...
end
Examples
The default function for 0.6.0, used if you don't supply your own.
  1. function love.run()
  2.  
  3.     if love.load then love.load() end
  4.  
  5.     -- Main loop.
  6.     while true do
  7.  
  8.         love.timer.step()
  9.         if love.update then love.update(love.timer.getDelta()) end
  10.         love.graphics.clear()
  11.         if love.draw then love.draw() end
  12.  
  13.         -- Process events.
  14.         for e,a,b,c in love.event.poll() do
  15.             if e == 'q' then
  16.                 if love.audio then
  17.                     love.audio.stop()
  18.                 end
  19.                 return
  20.             end
  21.             love.handlers[e](a,b,c)
  22.         end
  23.         love.timer.sleep(1)
  24.  
  25.         love.graphics.present()
  26.  
  27.     end
  28.  
  29. end
The default function for 0.6.1, used if you don't supply your own.
  1. function love.run()
  2.  
  3.     if love.load then love.load(arg) end
  4.  
  5.     local dt = 0
  6.  
  7.     -- Main loop time.
  8.     while true do
  9.         if love.timer then
  10.             love.timer.step()
  11.             dt = love.timer.getDelta()
  12.         end
  13.         if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
  14.         if love.graphics then
  15.             love.graphics.clear()
  16.             if love.draw then love.draw() end
  17.         end
  18.  
  19.         -- Process events.
  20.         if love.event then
  21.             for e,a,b,c in love.event.poll() do
  22.                 if e == "q" then
  23.                     if love.audio then
  24.                         love.audio.stop()
  25.                     end
  26.                     return
  27.                 end
  28.                 love.handlers[e](a,b,c)
  29.             end
  30.         end
  31.  
  32.         if love.timer then love.timer.sleep(1) end
  33.         if love.graphics then love.graphics.present() end
  34.  
  35.     end
  36.  
  37. end
Copyright © 2006-2010 LÖVE Development Team.