Browse Source

event docs;

bjorn 5 years ago
parent
commit
0d561a2e11
5 changed files with 16 additions and 11 deletions
  1. 5 5
      api/init.lua
  2. 3 2
      api/lovr/event/poll.lua
  3. 2 2
      api/lovr/event/pump.lua
  4. 1 1
      api/lovr/event/push.lua
  5. 5 1
      api/lovr/event/quit.lua

+ 5 - 5
api/init.lua

@@ -3826,7 +3826,7 @@ return {
         {
         {
           name = "poll",
           name = "poll",
           summary = "Iterate over unprocessed events in the queue.",
           summary = "Iterate over unprocessed events in the queue.",
-          description = "This function returns a Lua iterator for all of the unprocessed items in the event queue.  Each event consists of a name as a string, followed by event-specific arguments.  Typically this function is automatically called for you by `lovr.run`.",
+          description = "This function returns a Lua iterator for all of the unprocessed items in the event queue.  Each event consists of a name as a string, followed by event-specific arguments.  This function is called in the default implementation of `lovr.run`, so it is normally not necessary to poll for events yourself.",
           key = "lovr.event.poll",
           key = "lovr.event.poll",
           module = "lovr.event",
           module = "lovr.event",
           variants = {
           variants = {
@@ -3847,7 +3847,7 @@ return {
         {
         {
           name = "pump",
           name = "pump",
           summary = "Pump new events into the queue for processing.",
           summary = "Pump new events into the queue for processing.",
-          description = "Fills the event queue with unprocessed events from the operating system.  This function should be called often, otherwise the operating system will consider your application unresponsive.  By default, this function is called automatically by `lovr.run`.",
+          description = "Fills the event queue with unprocessed events from the operating system.  This function should be called often, otherwise the operating system will consider the application unresponsive. This function is called in the default implementation of `lovr.run`.",
           key = "lovr.event.pump",
           key = "lovr.event.pump",
           module = "lovr.event",
           module = "lovr.event",
           related = {
           related = {
@@ -3887,12 +3887,12 @@ return {
               returns = {}
               returns = {}
             }
             }
           },
           },
-          notes = "Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event payloads."
+          notes = "Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event data."
         },
         },
         {
         {
           name = "quit",
           name = "quit",
           summary = "Quit the application.",
           summary = "Quit the application.",
-          description = "Pushes an event to quit or restart the application.  An optional number can be passed to set the exit code for the application.  An exit code of zero indicates normal termination, whereas a nonzero exit code indicates that an error occurred.",
+          description = "Pushes an event to quit or restart the application.  An optional number can be passed to set the exit code for the application.  An exit code of zero indicates normal termination, whereas a nonzero exit code indicates that an error occurred.  Alternatively, the string 'restart' can be used to cause LÖVR to reload the project.",
           key = "lovr.event.quit",
           key = "lovr.event.quit",
           module = "lovr.event",
           module = "lovr.event",
           related = {
           related = {
@@ -3922,7 +3922,7 @@ return {
               returns = {}
               returns = {}
             }
             }
           },
           },
-          notes = "This function is equivalent to calling `lovr.event.push('quit', <args>)`.\n\nThe program won't actually exit until the next time `lovr.event.poll` is called."
+          notes = "This function is equivalent to calling `lovr.event.push('quit', <args>)`.\n\nThe program won't actually exit until the next time `lovr.event.poll` is called.\n\nThe `lovr.quit` callback will be called when the event is processed, which can be used to do any cleanup work.  The callback can also return `false` to stop the quitting process."
         }
         }
       },
       },
       examples = {
       examples = {

+ 3 - 2
api/lovr/event/poll.lua

@@ -2,8 +2,9 @@ return {
   summary = 'Iterate over unprocessed events in the queue.',
   summary = 'Iterate over unprocessed events in the queue.',
   description = [[
   description = [[
     This function returns a Lua iterator for all of the unprocessed items in the event queue.  Each
     This function returns a Lua iterator for all of the unprocessed items in the event queue.  Each
-    event consists of a name as a string, followed by event-specific arguments.  Typically this
-    function is automatically called for you by `lovr.run`.
+    event consists of a name as a string, followed by event-specific arguments.  This function is
+    called in the default implementation of `lovr.run`, so it is normally not necessary to poll for
+    events yourself.
   ]],
   ]],
   arguments = {},
   arguments = {},
   returns = {
   returns = {

+ 2 - 2
api/lovr/event/pump.lua

@@ -2,8 +2,8 @@ return {
   summary = 'Pump new events into the queue for processing.',
   summary = 'Pump new events into the queue for processing.',
   description = [[
   description = [[
     Fills the event queue with unprocessed events from the operating system.  This function should
     Fills the event queue with unprocessed events from the operating system.  This function should
-    be called often, otherwise the operating system will consider your application unresponsive.  By
-    default, this function is called automatically by `lovr.run`.
+    be called often, otherwise the operating system will consider the application unresponsive.
+    This function is called in the default implementation of `lovr.run`.
   ]],
   ]],
   arguments = {},
   arguments = {},
   returns = {},
   returns = {},

+ 1 - 1
api/lovr/event/push.lua

@@ -19,7 +19,7 @@ return {
   },
   },
   returns = {},
   returns = {},
   notes = [[
   notes = [[
-    Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event payloads.
+    Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event data.
   ]],
   ]],
   related = {
   related = {
     'lovr.event.poll',
     'lovr.event.poll',

+ 5 - 1
api/lovr/event/quit.lua

@@ -3,7 +3,8 @@ return {
   description = [[
   description = [[
     Pushes an event to quit or restart the application.  An optional number can be passed to set the
     Pushes an event to quit or restart the application.  An optional number can be passed to set the
     exit code for the application.  An exit code of zero indicates normal termination, whereas a
     exit code for the application.  An exit code of zero indicates normal termination, whereas a
-    nonzero exit code indicates that an error occurred.
+    nonzero exit code indicates that an error occurred.  Alternatively, the string 'restart' can be
+    used to cause LÖVR to reload the project.
   ]],
   ]],
   arguments = {
   arguments = {
     code = {
     code = {
@@ -31,6 +32,9 @@ return {
     This function is equivalent to calling `lovr.event.push('quit', <args>)`.
     This function is equivalent to calling `lovr.event.push('quit', <args>)`.
 
 
     The program won't actually exit until the next time `lovr.event.poll` is called.
     The program won't actually exit until the next time `lovr.event.poll` is called.
+
+    The `lovr.quit` callback will be called when the event is processed, which can be used to do any
+    cleanup work.  The callback can also return `false` to stop the quitting process.
   ]],
   ]],
   related = {
   related = {
     'lovr.quit',
     'lovr.quit',