bjorn il y a 3 jours
Parent
commit
95cb24aaae
54 fichiers modifiés avec 264 ajouts et 871 suppressions
  1. 97 470
      api/init.lua
  2. 6 1
      api/lovr/event/poll.lua
  3. 2 1
      api/lovr/event/push.lua
  4. 1 1
      api/lovr/event/quit.lua
  5. 5 13
      api/lovr/filesystem/append.lua
  6. 4 4
      api/lovr/filesystem/createDirectory.lua
  7. 1 1
      api/lovr/filesystem/getAppdataDirectory.lua
  8. 1 1
      api/lovr/filesystem/getDirectoryItems.lua
  9. 1 1
      api/lovr/filesystem/getExecutablePath.lua
  10. 1 1
      api/lovr/filesystem/getIdentity.lua
  11. 2 2
      api/lovr/filesystem/getLastModified.lua
  12. 5 2
      api/lovr/filesystem/getRealDirectory.lua
  13. 7 3
      api/lovr/filesystem/getSize.lua
  14. 1 1
      api/lovr/filesystem/getSource.lua
  15. 1 1
      api/lovr/filesystem/getUserDirectory.lua
  16. 1 1
      api/lovr/filesystem/getWorkingDirectory.lua
  17. 1 1
      api/lovr/filesystem/mount.lua
  18. 2 2
      api/lovr/filesystem/read.lua
  19. 1 1
      api/lovr/filesystem/remove.lua
  20. 2 10
      api/lovr/filesystem/write.lua
  21. 4 25
      api/lovr/graphics/Font/getKerning.lua
  22. 1 1
      api/lovr/graphics/Font/getLines.lua
  23. 5 2
      api/lovr/graphics/Font/getVertices.lua
  24. 1 1
      api/lovr/graphics/Mesh/getIndices.lua
  25. 1 1
      api/lovr/graphics/Mesh/getVertices.lua
  26. 1 1
      api/lovr/graphics/Mesh/setIndices.lua
  27. 3 6
      api/lovr/graphics/Mesh/setVertices.lua
  28. 3 11
      api/lovr/graphics/Model/animate.lua
  29. 4 12
      api/lovr/graphics/Model/getAnimationDuration.lua
  30. 4 12
      api/lovr/graphics/Model/getBlendShapeWeight.lua
  31. 4 12
      api/lovr/graphics/Model/getMaterial.lua
  32. 6 14
      api/lovr/graphics/Model/getNodeChildren.lua
  33. 4 12
      api/lovr/graphics/Model/getNodeOrientation.lua
  34. 3 11
      api/lovr/graphics/Model/getNodeParent.lua
  35. 4 12
      api/lovr/graphics/Model/getNodePose.lua
  36. 3 11
      api/lovr/graphics/Model/getNodePosition.lua
  37. 4 12
      api/lovr/graphics/Model/getNodeScale.lua
  38. 3 11
      api/lovr/graphics/Model/getNodeTransform.lua
  39. 2 2
      api/lovr/graphics/Model/getTriangles.lua
  40. 4 12
      api/lovr/graphics/Model/setBlendShapeWeight.lua
  41. 5 17
      api/lovr/graphics/Model/setNodeOrientation.lua
  42. 5 17
      api/lovr/graphics/Model/setNodePose.lua
  43. 5 13
      api/lovr/graphics/Model/setNodePosition.lua
  44. 5 17
      api/lovr/graphics/Model/setNodeScale.lua
  45. 6 22
      api/lovr/graphics/Model/setNodeTransform.lua
  46. 2 10
      api/lovr/graphics/compileShader.lua
  47. 1 1
      api/lovr/graphics/getWindowPass.lua
  48. 8 29
      api/lovr/graphics/newBuffer.lua
  49. 4 13
      api/lovr/graphics/newFont.lua
  50. 4 12
      api/lovr/graphics/newModel.lua
  51. 3 3
      api/lovr/graphics/newShader.lua
  52. 7 15
      api/lovr/graphics/newTexture.lua
  53. 1 1
      api/lovr/graphics/setBackgroundColor.lua
  54. 2 2
      api/lovr/graphics/submit.lua

Fichier diff supprimé car celui-ci est trop grand
+ 97 - 470
api/init.lua


+ 6 - 1
api/lovr/event/poll.lua

@@ -20,5 +20,10 @@ return {
       arguments = {},
       returns = { 'iterator' }
     }
-  }
+  },
+  example = [[
+    for name, arg1, arg2, arg3 in lovr.event.poll() do
+      print(name, arg1, arg2, arg3)
+    end
+  ]]
 }

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

@@ -23,7 +23,8 @@ return {
     }
   },
   notes = [[
-    Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event data.
+    Arguments can be nil, booleans, numbers, strings, lightuserdata, vectors, tables, and LÖVR
+    objects.
   ]],
   related = {
     'lovr.event.poll',

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

@@ -20,7 +20,7 @@ return {
     }
   },
   notes = [[
-    This function is equivalent to calling `lovr.event.push('quit', <args>)`.
+    This function is equivalent to calling `lovr.event.push('quit', code)`.
 
     The event won't be processed until the next time `lovr.event.poll` is called.
 

+ 5 - 13
api/lovr/filesystem/append.lua

@@ -8,32 +8,24 @@ return {
       description = 'The file to append to.'
     },
     content = {
-      type = 'string',
-      description = 'A string to write to the end of the file.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob containing data to append to the file.'
+      type = 'string | Blob',
+      description = 'A string or Blob to append to the file.'
     }
   },
   returns = {
     success = {
-      type = 'number',
+      type = 'boolean',
       description = 'Whether the operation was successful.'
     },
     error = {
-      type = 'string',
-      description = 'The error message, if there was an error.'
+      type = 'string | nil',
+      description = 'The error message, or `nil` if there was no error.'
     }
   },
   variants = {
     {
       arguments = { 'filename', 'content' },
       returns = { 'success', 'error' }
-    },
-    {
-      arguments = { 'filename', 'blob' },
-      returns = { 'success', 'error' }
     }
   },
   notes = 'If the file does not exist, it is created.'

+ 4 - 4
api/lovr/filesystem/createDirectory.lua

@@ -2,8 +2,8 @@ return {
   tag = 'filesystem-files',
   summary = 'Create a directory.',
   description = [[
-    Creates a directory in the save directory.  Any parent directories that don't exist will also be
-    created.
+    Creates a directory in the save directory.  Also creates any intermediate directories that don't
+    exist.
   ]],
   arguments = {
     path = {
@@ -17,8 +17,8 @@ return {
       description = 'Whether the directory was created.'
     },
     error = {
-      type = 'string',
-      description = 'The error message, if there was a failure.'
+      type = 'string | nil',
+      description = 'The error message.'
     }
   },
   variants = {

+ 1 - 1
api/lovr/filesystem/getAppdataDirectory.lua

@@ -11,7 +11,7 @@ return {
   arguments = {},
   returns = {
     path = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The absolute path to the appdata directory.'
     }
   },

+ 1 - 1
api/lovr/filesystem/getDirectoryItems.lua

@@ -10,7 +10,7 @@ return {
   },
   returns = {
     items = {
-      type = 'table',
+      type = '{string}',
       description = 'A table with a string for each file and subfolder in the directory.'
     }
   },

+ 1 - 1
api/lovr/filesystem/getExecutablePath.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   returns = {
     path = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The absolute path of the LÖVR executable, or `nil` if it is unknown.'
     }
   },

+ 1 - 1
api/lovr/filesystem/getIdentity.lua

@@ -8,7 +8,7 @@ return {
   arguments = {},
   returns = {
     identity = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The name of the save directory, or `nil` if it isn\'t set.'
     }
   },

+ 2 - 2
api/lovr/filesystem/getLastModified.lua

@@ -10,11 +10,11 @@ return {
   },
   returns = {
     time = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The modification time of the file, in seconds, or `nil` if there was an error.'
     },
     error = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The error message, if there was an error.'
     }
   },

+ 5 - 2
api/lovr/filesystem/getRealDirectory.lua

@@ -13,8 +13,11 @@ return {
   },
   returns = {
     realpath = {
-      type = 'string',
-      description = 'The absolute path of the mounted archive containing `path`.'
+      type = 'string | nil',
+      description = [[
+        The absolute path of the mounted archive containing `path`, or `nil` if the file is not in
+        the virtual filesystem.
+      ]]
     }
   },
   variants = {

+ 7 - 3
api/lovr/filesystem/getSize.lua

@@ -10,14 +10,18 @@ return {
   },
   returns = {
     size = {
-      type = 'number',
-      description = 'The size of the file, in bytes.'
+      type = 'number | nil',
+      description = 'The size of the file, in bytes, or `nil` if there was an error.'
+    },
+    error = {
+      type = 'string | nil',
+      description = 'The error message, if the operation was not successful.'
     }
   },
   variants = {
     {
       arguments = { 'file' },
-      returns = { 'size' }
+      returns = { 'size', 'error' }
     }
   },
   notes = 'If the file does not exist, an error is thrown.',

+ 1 - 1
api/lovr/filesystem/getSource.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   returns = {
     path = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The absolute path of the project\'s source, or `nil` if it\'s unknown.'
     }
   },

+ 1 - 1
api/lovr/filesystem/getUserDirectory.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   returns = {
     path = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The absolute path of the user\'s home directory.'
     }
   },

+ 1 - 1
api/lovr/filesystem/getWorkingDirectory.lua

@@ -8,7 +8,7 @@ return {
   arguments = {},
   returns = {
     path = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The current working directory, or `nil` if it\'s unknown.'
     }
   },

+ 1 - 1
api/lovr/filesystem/mount.lua

@@ -37,7 +37,7 @@ return {
       description = 'Whether the archive was successfully mounted.'
     },
     error = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The error message, if the archive failed to mount.'
     }
   },

+ 2 - 2
api/lovr/filesystem/read.lua

@@ -10,11 +10,11 @@ return {
   },
   returns = {
     contents = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The contents of the file, or nil if the file could not be read.'
     },
     error = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The error message, if any.'
     }
   },

+ 1 - 1
api/lovr/filesystem/remove.lua

@@ -14,7 +14,7 @@ return {
       description = 'Whether the path was removed.'
     },
     error = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The error message, if any.'
     }
   },

+ 2 - 10
api/lovr/filesystem/write.lua

@@ -8,12 +8,8 @@ return {
       description = 'The file to write to.'
     },
     content = {
-      type = 'string',
-      description = 'A string to write to the file.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob containing data to write to the file.'
+      type = 'string | Blob',
+      description = 'A string or Blob to write to the file.'
     }
   },
   returns = {
@@ -30,10 +26,6 @@ return {
     {
       arguments = { 'filename', 'content' },
       returns = { 'success', 'error' }
-    },
-    {
-      arguments = { 'filename', 'blob' },
-      returns = { 'success', 'error' }
     }
   },
   notes = [[

+ 4 - 25
api/lovr/graphics/Font/getKerning.lua

@@ -7,21 +7,12 @@ return {
   ]],
   arguments = {
     first = {
-      type = 'string',
-      description = 'The first character.'
-    },
-    firstCodepoint = {
-      type = 'number',
-      description = 'The first codepoint.'
+      type = 'string | number',
+      description = 'The first character or codepoint.'
     },
     second = {
-      type = 'string',
-      description = 'The second character.'
-    },
-    secondCodepoint = {
-      name = 'secondCodepoint',
-      type = 'number',
-      description = 'The second codepoint.'
+      type = 'string | number',
+      description = 'The second character or codepoint.'
     }
   },
   returns = {
@@ -34,18 +25,6 @@ return {
     {
       arguments = { 'first', 'second' },
       returns = { 'keming' }
-    },
-    {
-      arguments = { 'firstCodepoint', 'second' },
-      returns = { 'keming' }
-    },
-    {
-      arguments = { 'first', 'secondCodepoint' },
-      returns = { 'keming' }
-    },
-    {
-      arguments = { 'firstCodepoint', 'secondCodepoint' },
-      returns = { 'keming' }
     }
   },
   related = {

+ 1 - 1
api/lovr/graphics/Font/getLines.lua

@@ -25,7 +25,7 @@ return {
   },
   returns = {
     lines = {
-      type = 'table',
+      type = '{string}',
       description = 'A table of strings, one for each wrapped line.'
     }
   },

+ 5 - 2
api/lovr/graphics/Font/getVertices.lua

@@ -36,7 +36,7 @@ return {
   },
   returns = {
     vertices = {
-      type = 'table',
+      type = '{number}',
       description = 'The table of vertices.  See below for the format of each vertex.'
     },
     material = {
@@ -61,6 +61,9 @@ return {
 
     These could be placed in a vertex buffer using the following buffer format:
 
-        { 'vec2:VertexPosition', 'vec2:VertexUV' }
+        {
+          { 'VertexPosition', 'vec2' },
+          { 'VertexUV', 'vec2' }
+        }
   ]]
 }

+ 1 - 1
api/lovr/graphics/Mesh/getIndices.lua

@@ -4,7 +4,7 @@ return {
   arguments = {},
   returns = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A table of numbers with the 1-based vertex indices.'
     }
   },

+ 1 - 1
api/lovr/graphics/Mesh/getVertices.lua

@@ -18,7 +18,7 @@ return {
   },
   returns = {
     vertices = {
-      type = 'table',
+      type = '{{number}}',
       description = [[
         A table of vertices.  Each vertex is a table of numbers for each vertex attribute, given by
         the vertex format of the Mesh.

+ 1 - 1
api/lovr/graphics/Mesh/setIndices.lua

@@ -9,7 +9,7 @@ return {
   ]],
   arguments = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A list of numbers (1-based).'
     },
     blob = {

+ 3 - 6
api/lovr/graphics/Mesh/setVertices.lua

@@ -3,7 +3,7 @@ return {
   description = 'Sets the data for vertices in the Mesh.',
   arguments = {
     vertices = {
-      type = 'table',
+      type = '{{number}}',
       description = [[
         A table of vertices, where each vertex is a table of numbers matching the vertex format of
         the Mesh.
@@ -16,15 +16,12 @@ return {
     index = {
       type = 'number',
       default = '1',
-      description = 'The index of the first vertex to return.'
+      description = 'The index of the first vertex to set.'
     },
     count = {
       type = 'number',
       default = 'nil',
-      description = [[
-        The number of vertices to return.  If nil, returns the "rest" of the vertices, based on the
-        `index` argument.
-      ]]
+      description = 'The number of vertices to set.'
     }
   },
   returns = {},

+ 3 - 11
api/lovr/graphics/Model/animate.lua

@@ -10,13 +10,9 @@ return {
     remain unchanged.
   ]],
   arguments = {
-    name = {
+    animation = {
       type = 'string',
-      description = 'The name of an animation in the model file.'
-    },
-    index = {
-      type = 'number',
-      description = 'The index of an animation in the model file.'
+      description = 'The name or index of an animation in the model file.'
     },
     time = {
       type = 'number',
@@ -31,11 +27,7 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'name', 'time', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'time', 'blend' },
+      arguments = { 'animation', 'time', 'blend' },
       returns = {}
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getAnimationDuration.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get the duration of an animation in the Model.',
   description = 'Returns the duration of an animation in the Model, in seconds.',
   arguments = {
-    name = {
-      type = 'string',
-      description = 'The name of the animation.'
-    },
-    index = {
-      type = 'number',
-      description = 'The animation index.'
+    animation = {
+      type = 'string | number',
+      description = 'The name or index of an animation.'
     }
   },
   returns = {
@@ -19,11 +15,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index' },
-      returns = { 'duration' }
-    },
-    {
-      arguments = { 'name' },
+      arguments = { 'animation' },
       returns = { 'duration' }
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getBlendShapeWeight.lua

@@ -7,13 +7,9 @@ return {
     zero won't apply any displacement and will skip processing of the blend shape.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of a blend shape.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of a blend shape.'
+    blendshape = {
+      type = 'string | number',
+      description = 'The name or index of a blend shape.'
     }
   },
   returns = {
@@ -24,11 +20,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index' },
-      returns = { 'weight' }
-    },
-    {
-      arguments = { 'name' },
+      arguments = { 'blendshape' },
       returns = { 'weight' }
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getMaterial.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get a Material from the Model.',
   description = 'Returns a `Material` loaded from the Model.',
   arguments = {
-    name = {
-      type = 'string',
-      description = 'The name of the Material to return.'
-    },
-    index = {
-      type = 'number',
-      description = 'The index of the Material to return.'
+    which = {
+      type = 'string | number',
+      description = 'The name or index of the Material to return.'
     }
   },
   returns = {
@@ -19,11 +15,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'name' },
-      returns = { 'material' }
-    },
-    {
-      arguments = { 'index' },
+      arguments = { 'which' },
       returns = { 'material' }
     }
   },

+ 6 - 14
api/lovr/graphics/Model/getNodeChildren.lua

@@ -4,28 +4,20 @@ return {
     Given a parent node, this function returns a table with the indices of its children.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the parent node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the parent node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of the parent node.'
     }
   },
   returns = {
     children = {
-      type = 'table',
-      description = 'A table containing a node index for each child of the node.'
+      type = '{number}',
+      description = 'A table containing the node index of each child of the parent node.'
     }
   },
   variants = {
     {
-      arguments = { 'index' },
-      returns = { 'children' }
-    },
-    {
-      arguments = { 'name' },
+      arguments = { 'node' },
       returns = { 'children' }
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getNodeOrientation.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get the orientation of a node.',
   description = 'Returns the orientation of a node.',
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     origin = {
       type = 'OriginType',
@@ -38,11 +34,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index', 'origin' },
-      returns = { 'angle', 'ax', 'ay', 'az' }
-    },
-    {
-      arguments = { 'name', 'origin' },
+      arguments = { 'node', 'origin' },
       returns = { 'angle', 'ax', 'ay', 'az' }
     }
   },

+ 3 - 11
api/lovr/graphics/Model/getNodeParent.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get the parent of a node.',
   description = 'Given a child node, this function returns the index of its parent.',
   arguments = {
-    index = {
+    node = {
       type = 'number',
-      description = 'The index of the child node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the child node.'
+      description = 'The name or index of the child node.'
     }
   },
   returns = {
@@ -19,11 +15,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index' },
-      returns = { 'parent' }
-    },
-    {
-      arguments = { 'name' },
+      arguments = { 'node' },
       returns = { 'parent' }
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getNodePose.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get the pose of a node.',
   description = 'Returns the pose (position and orientation) of a node.',
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of a node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of a node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     origin = {
       type = 'OriginType',
@@ -50,11 +46,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index', 'origin' },
-      returns = { 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az' }
-    },
-    {
-      arguments = { 'name', 'origin' },
+      arguments = { 'node', 'origin' },
       returns = { 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az' }
     }
   },

+ 3 - 11
api/lovr/graphics/Model/getNodePosition.lua

@@ -2,14 +2,10 @@ return {
   summary = 'Get the position of a node.',
   description = 'Returns the position of a node.',
   arguments = {
-    index = {
-      type = 'number',
+    node = {
+      type = 'string | number',
       description = 'The index of the node.'
     },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
-    },
     space = {
       type = 'OriginType',
       default = [['root']],
@@ -34,11 +30,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index', 'space' },
-      returns = { 'x', 'y', 'z' }
-    },
-    {
-      arguments = { 'name', 'space' },
+      arguments = { 'node', 'space' },
       returns = { 'x', 'y', 'z' }
     }
   },

+ 4 - 12
api/lovr/graphics/Model/getNodeScale.lua

@@ -2,13 +2,9 @@ return {
   summary = 'Get the scale of a node.',
   description = 'Returns the scale of a node.',
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of the node.'
     },
     origin = {
       type = 'OriginType',
@@ -34,11 +30,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index', 'origin' },
-      returns = { 'x', 'y', 'z' }
-    },
-    {
-      arguments = { 'name', 'origin' },
+      arguments = { 'node', 'origin' },
       returns = { 'x', 'y', 'z' }
     }
   },

+ 3 - 11
api/lovr/graphics/Model/getNodeTransform.lua

@@ -2,14 +2,10 @@ return {
   summary = 'Get the transform of a node.',
   description = 'Returns the transform (position, scale, and rotation) of a node.',
   arguments = {
-    index = {
-      type = 'number',
+    node = {
+      type = 'string | number',
       description = 'The index of a node.'
     },
-    name = {
-      type = 'string',
-      description = 'The name of a node.'
-    },
     origin = {
       type = 'OriginType',
       default = [['root']],
@@ -62,11 +58,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'index', 'origin' },
-      returns = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' }
-    },
-    {
-      arguments = { 'name', 'origin' },
+      arguments = { 'node', 'origin' },
       returns = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' }
     }
   },

+ 2 - 2
api/lovr/graphics/Model/getTriangles.lua

@@ -13,14 +13,14 @@ return {
   arguments = {},
   returns = {
     vertices = {
-      type = 'table',
+      type = '{number}',
       description = [[
         The triangle vertex positions, returned as a flat (non-nested) table of numbers.  The
         position of each vertex is given as an x, y, and z coordinate.
       ]]
     },
     indices = {
-      type = 'table',
+      type = '{number}',
       description = [[
         A list of numbers representing how to connect the vertices into triangles.  Each number is
         a 1-based index into the `vertices` table, and every 3 indices form a triangle.

+ 4 - 12
api/lovr/graphics/Model/setBlendShapeWeight.lua

@@ -7,13 +7,9 @@ return {
     won't apply any displacement and will skip processing of the blend shape.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of a blend shape.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of a blend shape.'
+    blendshape = {
+      type = 'string | number',
+      description = 'The name or index of a blend shape.'
     },
     weight = {
       type = 'number',
@@ -23,11 +19,7 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'weight' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'weight' },
+      arguments = { 'blendshape', 'weight' },
       returns = {}
     }
   },

+ 5 - 17
api/lovr/graphics/Model/setNodeOrientation.lua

@@ -5,13 +5,9 @@ return {
     of the node, relative to its parent.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     angle = {
       type = 'number',
@@ -46,19 +42,11 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'orientation', 'blend' },
+      arguments = { 'node', 'angle', 'ax', 'ay', 'az', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'name', 'orientation', 'blend' },
+      arguments = { 'node', 'orientation', 'blend' },
       returns = {}
     }
   },

+ 5 - 17
api/lovr/graphics/Model/setNodePose.lua

@@ -5,13 +5,9 @@ return {
     pose of the node, relative to its parent.  The scale will remain unchanged.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     x = {
       type = 'number',
@@ -61,19 +57,11 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'position', 'orientation', 'blend' },
+      arguments = { 'node', 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'name', 'position', 'orientation', 'blend' },
+      arguments = { 'node', 'position', 'orientation', 'blend' },
       returns = {}
     }
   },

+ 5 - 13
api/lovr/graphics/Model/setNodePosition.lua

@@ -5,9 +5,9 @@ return {
     its parent.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     name = {
       type = 'string',
@@ -41,19 +41,11 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'x', 'y', 'z', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'x', 'y', 'z', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'position', 'blend' },
+      arguments = { 'node', 'x', 'y', 'z', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'name', 'position', 'blend' },
+      arguments = { 'node', 'position', 'blend' },
       returns = {}
     }
   },

+ 5 - 17
api/lovr/graphics/Model/setNodeScale.lua

@@ -5,13 +5,9 @@ return {
     relative to its parent.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     sx = {
       type = 'number',
@@ -41,19 +37,11 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'sx', 'sy', 'sz', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'sx', 'sy', 'sz', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'scale', 'blend' },
+      arguments = { 'node', 'sx', 'sy', 'sz', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'name', 'scale', 'blend' },
+      arguments = { 'node', 'scale', 'blend' },
       returns = {}
     }
   },

+ 6 - 22
api/lovr/graphics/Model/setNodeTransform.lua

@@ -5,13 +5,9 @@ return {
     node, relative to its parent.
   ]],
   arguments = {
-    index = {
-      type = 'number',
-      description = 'The index of the node.'
-    },
-    name = {
-      type = 'string',
-      description = 'The name of the node.'
+    node = {
+      type = 'string | number',
+      description = 'The name or index of a node.'
     },
     x = {
       type = 'number',
@@ -82,27 +78,15 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'index', 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'index', 'position', 'scale', 'orientation', 'blend' },
-      returns = {}
-    },
-    {
-      arguments = { 'name', 'position', 'scale', 'orientation', 'blend' },
+      arguments = { 'node', 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'index', 'transform', 'blend' },
+      arguments = { 'node', 'position', 'scale', 'orientation', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'name', 'transform', 'blend' },
+      arguments = { 'node', 'transform', 'blend' },
       returns = {}
     }
   },

+ 2 - 10
api/lovr/graphics/compileShader.lua

@@ -13,12 +13,8 @@ return {
       description = 'The type of shader to compile.'
     },
     source = {
-      type = 'string',
-      description = 'A string or filename with shader code.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob containing shader code.'
+      type = 'string | Blob',
+      description = 'A string, filename, or Blob with shader code.'
     }
   },
   returns = {
@@ -31,10 +27,6 @@ return {
     {
       arguments = { 'stage', 'source' },
       returns = { 'bytecode' }
-    },
-    {
-      arguments = { 'stage', 'blob' },
-      returns = { 'bytecode' }
     }
   },
   notes = [[

+ 1 - 1
api/lovr/graphics/getWindowPass.lua

@@ -9,7 +9,7 @@ return {
   arguments = {},
   returns = {
     pass = {
-      type = 'Pass',
+      type = 'Pass | nil',
       description = 'The window pass, or `nil` if there is no window.'
     }
   },

+ 8 - 29
api/lovr/graphics/newBuffer.lua

@@ -13,27 +13,22 @@ return {
       description = 'The length of the Buffer.'
     },
     data = {
-      type = 'table',
+      type = 'table | Blob',
       description = [[
         The initial data to put into the Buffer.  The length of the Buffer will be determined by the
-        contents of the table.  The contents can be a mix of tables, numbers, and vectors, but the
-        length calculation requires each field to consistently use one type of data.
+        length of the table or the size of the Blob, combined with the format information.
       ]]
     },
     blob = {
       type = 'Blob',
-      description = [[
-        A Blob with the initial contents of the Buffer.  The size of the Blob will be used to
-        determine the length of the Buffer.
-      ]]
-    },
-    type = {
-      type = 'DataType',
-      description = 'The type of each item in the Buffer.'
+      description = 'A Blob with the initial contents of the Buffer.'
     },
     format = {
-      type = 'table',
-      description = 'A list of fields in the Buffer.',
+      type = 'table | DataType',
+      description = [[
+        A list of fields in the Buffer.  A `DataType` can also be used for buffers that are simple
+        arrays.
+      ]],
       table = {
         {
           name = 'layout',
@@ -75,22 +70,6 @@ return {
     {
       arguments = { 'format', 'data' },
       returns = { 'buffer' }
-    },
-    {
-      arguments = { 'format', 'blob' },
-      returns = { 'buffer' }
-    },
-    {
-      arguments = { 'type', 'length' },
-      returns = { 'buffer' }
-    },
-    {
-      arguments = { 'type', 'data' },
-      returns = { 'buffer' }
-    },
-    {
-      arguments = { 'type', 'blob' },
-      returns = { 'buffer' }
     }
   },
   notes = [[

+ 4 - 13
api/lovr/graphics/newFont.lua

@@ -3,13 +3,9 @@ return {
   summary = 'Create a new Font.',
   description = 'Creates a new Font.',
   arguments = {
-    filename = {
-      type = 'string',
-      description = 'A path to a TTF or BMFont file.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob containing TTF or BMFont file data.'
+    file = {
+      type = 'string | Blob',
+      description = 'A filename or Blob containing a TTF or BMFont file.'
     },
     rasterizer = {
       type = 'Rasterizer',
@@ -43,12 +39,7 @@ return {
   variants = {
     {
       description = 'Creates a new Font from a font file.',
-      arguments = { 'filename', 'size', 'spread' },
-      returns = { 'font' }
-    },
-    {
-      description = 'Creates a new Font from font data.',
-      arguments = { 'blob', 'size', 'spread' },
+      arguments = { 'file', 'size', 'spread' },
       returns = { 'font' }
     },
     {

+ 4 - 12
api/lovr/graphics/newModel.lua

@@ -5,13 +5,9 @@ return {
     Loads a 3D model from a file.  Currently, OBJ, glTF, and binary STL files are supported.
   ]],
   arguments = {
-    filename = {
-      type = 'string',
-      description = 'The path to model file.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob containing 3D model data.'
+    file = {
+      type = 'string | Blob',
+      description = 'A filename or Blob containing 3D model data to import.'
     },
     modelData = {
       type = 'ModelData',
@@ -49,11 +45,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'filename', 'options' },
-      returns = { 'model' }
-    },
-    {
-      arguments = { 'blob', 'options' },
+      arguments = { 'file', 'options' },
       returns = { 'model' }
     },
     {

+ 3 - 3
api/lovr/graphics/newShader.lua

@@ -14,21 +14,21 @@ return {
   ]],
   arguments = {
     vertex = {
-      type = 'string',
+      type = 'string | DefaultShader | Blob',
       description = [[
         A string, path to a file, or Blob containing GLSL or SPIR-V code for the vertex stage.  Can
         also be a `DefaultShader` to use that shader's vertex code.
       ]]
     },
     fragment = {
-      type = 'string',
+      type = 'string | DefaultShader | Blob',
       description = [[
         A string, path to a file, or Blob containing GLSL or SPIR-V code for the fragment stage.
         Can also be a `DefaultShader` to use that shader's fragment code.
       ]]
     },
     compute = {
-      type = 'string',
+      type = 'string | Blob',
       description = [[
         A string, path to a file, or Blob containing GLSL or SPIR-V code for the compute stage.
       ]]

+ 7 - 15
api/lovr/graphics/newTexture.lua

@@ -7,18 +7,14 @@ return {
     which will create an empty texture.
   ]],
   arguments = {
-    filename = {
-      type = 'string',
-      description = 'The filename of an image to load.'
+    file = {
+      type = 'string | Blob',
+      description = 'A filename or Blob containing an image file to load.'
     },
     image = {
       type = 'string',
       description = 'An Image object holding pixel data to load into the Texture.'
     },
-    blob = {
-      type = 'Blob',
-      description = 'A Blob object holding pixel data to load into the Texture.'
-    },
     width = {
       type = 'number',
       description = 'The width of the Texture, in pixels.'
@@ -32,7 +28,7 @@ return {
       description = 'The number of layers in the Texture.'
     },
     images = {
-      type = 'table',
+      type = '{string | Blob | Image}',
       description = 'A table of filenames or Images to load into the Texture.'
     },
     options = {
@@ -70,7 +66,7 @@ return {
         },
         {
           name = 'mipmaps',
-          type = '*',
+          type = 'boolean | number',
           default = 'true',
           description = [[
             The number of mipmap levels in the texture, or a boolean.  If true, a full mipmap chain
@@ -79,7 +75,7 @@ return {
         },
         {
           name = 'usage',
-          type = 'table',
+          type = '{TextureUsage}',
           description = 'A list of `TextureUsage` indicating how the texture will be used.'
         },
         {
@@ -98,7 +94,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'filename', 'options' },
+      arguments = { 'file', 'options' },
       returns = { 'texture' }
     },
     {
@@ -116,10 +112,6 @@ return {
     {
       arguments = { 'images', 'options' },
       returns = { 'texture' }
-    },
-    {
-      arguments = { 'blob', 'options' },
-      returns = { 'texture' }
     }
   },
   notes = [[

+ 1 - 1
api/lovr/graphics/setBackgroundColor.lua

@@ -31,7 +31,7 @@ return {
       ]]
     },
     table = {
-      type = 'table',
+      type = '{number}',
       description = 'A table containing 3 or 4 color components.'
     }
   },

+ 2 - 2
api/lovr/graphics/submit.lua

@@ -4,11 +4,11 @@ return {
   description = 'Submits work to the GPU.',
   arguments = {
     ['...'] = {
-      type = 'Pass',
+      type = 'Pass | false | nil',
       description = 'The pass objects to submit.  Falsy values will be skipped.'
     },
     t = {
-      type = 'table',
+      type = '{Pass | false}',
       description = 'A table of passes to submit.  Falsy values will be skipped.'
     }
   },

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff