2
0
bjorn 2 өдөр өмнө
parent
commit
630325de9c
55 өөрчлөгдсөн 213 нэмэгдсэн , 569 устгасан
  1. 106 372
      api/init.lua
  2. 2 2
      api/lovr/graphics/Pass/draw.lua
  3. 1 1
      api/lovr/graphics/Pass/line.lua
  4. 1 1
      api/lovr/graphics/Pass/points.lua
  5. 1 1
      api/lovr/graphics/Pass/polygon.lua
  6. 1 1
      api/lovr/graphics/Pass/setColor.lua
  7. 2 10
      api/lovr/graphics/Pass/setMaterial.lua
  8. 7 11
      api/lovr/graphics/Pass/setSampler.lua
  9. 3 12
      api/lovr/graphics/Pass/setShader.lua
  10. 4 11
      api/lovr/graphics/Pass/setStencilWrite.lua
  11. 1 1
      api/lovr/graphics/Texture/clear.lua
  12. 4 8
      api/lovr/graphics/Texture/setPixels.lua
  13. 1 1
      api/lovr/headset/Layer/setColor.lua
  14. 1 1
      api/lovr/headset/getAxis.lua
  15. 1 0
      api/lovr/headset/getBoundsDepth.lua
  16. 1 0
      api/lovr/headset/getBoundsDimensions.lua
  17. 1 0
      api/lovr/headset/getBoundsWidth.lua
  18. 1 1
      api/lovr/headset/getHands.lua
  19. 1 1
      api/lovr/headset/getLayers.lua
  20. 1 2
      api/lovr/headset/getName.lua
  21. 1 1
      api/lovr/headset/getPass.lua
  22. 1 1
      api/lovr/headset/getRefreshRate.lua
  23. 1 1
      api/lovr/headset/getRefreshRates.lua
  24. 1 1
      api/lovr/headset/getSkeleton.lua
  25. 1 1
      api/lovr/headset/getTexture.lua
  26. 4 4
      api/lovr/headset/getViewAngles.lua
  27. 7 7
      api/lovr/headset/getViewPose.lua
  28. 1 1
      api/lovr/headset/isDown.lua
  29. 1 1
      api/lovr/headset/isTouched.lua
  30. 7 30
      api/lovr/headset/setBackground.lua
  31. 1 6
      api/lovr/headset/wasPressed.lua
  32. 1 1
      api/lovr/math/Curve/render.lua
  33. 1 1
      api/lovr/math/gammaToLinear.lua
  34. 1 1
      api/lovr/math/linearToGamma.lua
  35. 5 3
      api/lovr/physics/Collider/getShape.lua
  36. 1 1
      api/lovr/physics/Collider/getTag.lua
  37. 2 0
      api/lovr/physics/Collider/setDegreesOfFreedom.lua
  38. 1 1
      api/lovr/physics/Shape/raycast.lua
  39. 4 4
      api/lovr/physics/World/getCallbacks.lua
  40. 1 1
      api/lovr/physics/World/getColliders.lua
  41. 1 1
      api/lovr/physics/World/getJoints.lua
  42. 1 1
      api/lovr/physics/World/getTags.lua
  43. 1 0
      api/lovr/physics/World/overlapShape.lua
  44. 1 0
      api/lovr/physics/World/queryBox.lua
  45. 1 0
      api/lovr/physics/World/querySphere.lua
  46. 2 1
      api/lovr/physics/World/raycast.lua
  47. 1 1
      api/lovr/physics/World/setCallbacks.lua
  48. 4 20
      api/lovr/physics/newConvexShape.lua
  49. 4 23
      api/lovr/physics/newMeshShape.lua
  50. 2 2
      api/lovr/system/getClipboardText.lua
  51. 1 1
      api/lovr/thread/Channel/pop.lua
  52. 1 1
      api/lovr/thread/Channel/push.lua
  53. 1 1
      api/lovr/thread/Thread/getError.lua
  54. 4 1
      api/lovr/thread/Thread/start.lua
  55. 4 12
      api/lovr/thread/newThread.lua

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 106 - 372
api/init.lua


+ 2 - 2
api/lovr/graphics/Pass/draw.lua

@@ -4,8 +4,8 @@ return {
   description = 'Draws a `Model`, `Mesh`, or `Texture`.',
   description = 'Draws a `Model`, `Mesh`, or `Texture`.',
   arguments = {
   arguments = {
     object = {
     object = {
-      type = '*',
-      description = 'The Model, Mesh, or Texture to draw.'
+      type = 'Model | Mesh | Texture',
+      description = 'The object to draw.'
     },
     },
     x = {
     x = {
       type = 'number',
       type = 'number',

+ 1 - 1
api/lovr/graphics/Pass/line.lua

@@ -31,7 +31,7 @@ return {
       description = 'The z coordinate of the next point.'
       description = 'The z coordinate of the next point.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number | Vec3}',
       description = [[
       description = [[
         A table of numbers or `Vec3` objects (not a mix) representing points of the line.
         A table of numbers or `Vec3` objects (not a mix) representing points of the line.
       ]]
       ]]

+ 1 - 1
api/lovr/graphics/Pass/points.lua

@@ -16,7 +16,7 @@ return {
       description = 'The z coordinate of the first point.'
       description = 'The z coordinate of the first point.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number | Vec3}',
       description = 'A table of numbers or Vec3 objects (not both) representing point positions.'
       description = 'A table of numbers or Vec3 objects (not both) representing point positions.'
     },
     },
     v = {
     v = {

+ 1 - 1
api/lovr/graphics/Pass/polygon.lua

@@ -32,7 +32,7 @@ return {
       description = 'The z coordinate of the next vertex.'
       description = 'The z coordinate of the next vertex.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number | Vec3}',
       description = [[
       description = [[
         A table of numbers or `Vec3` objects (not a mix) representing vertices of the polygon.
         A table of numbers or `Vec3` objects (not a mix) representing vertices of the polygon.
       ]]
       ]]

+ 1 - 1
api/lovr/graphics/Pass/setColor.lua

@@ -21,7 +21,7 @@ return {
       description = 'The alpha component of the color.'
       description = 'The alpha component of the color.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A table of 3 or 4 color components.'
       description = 'A table of 3 or 4 color components.'
     },
     },
     hex = {
     hex = {

+ 2 - 10
api/lovr/graphics/Pass/setMaterial.lua

@@ -7,12 +7,8 @@ return {
   ]],
   ]],
   arguments = {
   arguments = {
     material = {
     material = {
-      type = 'Material',
-      description = 'The material to use for drawing.'
-    },
-    texture = {
-      type = 'Texture',
-      description = 'The texture to use as the material.'
+      type = 'Texture | Material',
+      description = 'The texture or material to apply to surfaces.'
     }
     }
   },
   },
   returns = {},
   returns = {},
@@ -21,10 +17,6 @@ return {
       arguments = { 'material' },
       arguments = { 'material' },
       returns = {}
       returns = {}
     },
     },
-    {
-      arguments = { 'texture' },
-      returns = {}
-    },
     {
     {
       description = 'Use the default material.',
       description = 'Use the default material.',
       arguments = {},
       arguments = {},

+ 7 - 11
api/lovr/graphics/Pass/setSampler.lua

@@ -8,23 +8,16 @@ return {
   ]],
   ]],
   arguments = {
   arguments = {
     sampler = {
     sampler = {
-      type = 'Sampler',
-      description = 'The default sampler shaders will use when reading from textures.'
-    },
-    filter = {
-      type = 'FilterMode',
+      type = 'Sampler | FilterMode',
       default = [['linear']],
       default = [['linear']],
       description = [[
       description = [[
-        The default filter mode to use when sampling textures (the `repeat` wrap mode will be used).
-      ]]
+        The Sampler shaders will use when reading from textures.  It can also be a `FilterMode`, for
+        convenience (other sampler settings will use their defaults).
+      ]],
     }
     }
   },
   },
   returns = {},
   returns = {},
   variants = {
   variants = {
-    {
-      arguments = { 'filter' },
-      returns = {}
-    },
     {
     {
       arguments = { 'sampler' },
       arguments = { 'sampler' },
       returns = {}
       returns = {}
@@ -36,6 +29,9 @@ return {
     When a Pass is reset, its sampler will be reset to `linear`.
     When a Pass is reset, its sampler will be reset to `linear`.
 
 
     The sampler applies to all draws in the pass on submit, regardless of when the sampler is set.
     The sampler applies to all draws in the pass on submit, regardless of when the sampler is set.
+
+    If you need different samplers for each draw, currently you have to send a `Sampler` object to a
+    Shader (this is not ideal).
   ]],
   ]],
   example = [[
   example = [[
     function lovr.draw(pass)
     function lovr.draw(pass)

+ 3 - 12
api/lovr/graphics/Pass/setShader.lua

@@ -2,17 +2,13 @@ return {
   tag = 'shaders',
   tag = 'shaders',
   summary = 'Set the active Shader.',
   summary = 'Set the active Shader.',
   description = [[
   description = [[
-    Sets the active shader.  In a render pass, the Shader will affect all drawing operations until
-    it is changed again.  In a compute pass, the Shader will be run when `Pass:compute` is called.
+    Sets the active shader.  The Shader will affect all drawing operations until it is changed
+    again.
   ]],
   ]],
   arguments = {
   arguments = {
     shader = {
     shader = {
-      type = 'Shader',
+      type = 'Shader | DefaultShader',
       description = 'The shader to use.'
       description = 'The shader to use.'
-    },
-    defaultshader = {
-      type = 'DefaultShader',
-      description = 'One of the default shaders to use.'
     }
     }
   },
   },
   returns = {},
   returns = {},
@@ -21,11 +17,6 @@ return {
       arguments = { 'shader' },
       arguments = { 'shader' },
       returns = {}
       returns = {}
     },
     },
-    {
-      description = 'Use one of the default shaders for drawing.',
-      arguments = { 'defaultshader' },
-      returns = {}
-    },
     {
     {
       description = 'Switch back to using an automatic shader for drawing.',
       description = 'Switch back to using an automatic shader for drawing.',
       arguments = {},
       arguments = {},

+ 4 - 11
api/lovr/graphics/Pass/setStencilWrite.lua

@@ -7,14 +7,11 @@ return {
   ]],
   ]],
   arguments = {
   arguments = {
     action = {
     action = {
-      type = 'StencilAction',
-      description = 'How pixels drawn will update the stencil buffer.'
-    },
-    actions = {
-      type = 'table',
+      type = 'StencilAction | {StencilAction}',
       description = [[
       description = [[
-        A list of 3 stencil actions, used when a pixel fails the stencil test, fails
-        the depth test, or passes the stencil test, respectively.
+        How pixels should update the stencil buffer when they are drawn.  Can also be a list of 3
+        stencil actions, used when a pixel fails the stencil test, fails the depth test, or passes
+        the stencil test, respectively.
       ]]
       ]]
     },
     },
     value = {
     value = {
@@ -34,10 +31,6 @@ return {
       arguments = { 'action', 'value', 'mask' },
       arguments = { 'action', 'value', 'mask' },
       returns = {}
       returns = {}
     },
     },
-    {
-      arguments = { 'actions', 'value', 'mask' },
-      returns = {}
-    },
     {
     {
       description = 'Disables stencil writing.',
       description = 'Disables stencil writing.',
       arguments = {},
       arguments = {},

+ 1 - 1
api/lovr/graphics/Texture/clear.lua

@@ -29,7 +29,7 @@ return {
       description = 'The alpha component of the clear color.'
       description = 'The alpha component of the clear color.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A table with color components.'
       description = 'A table with color components.'
     },
     },
     v3 = {
     v3 = {

+ 4 - 8
api/lovr/graphics/Texture/setPixels.lua

@@ -6,9 +6,9 @@ return {
     another `Texture` object to copy from.
     another `Texture` object to copy from.
   ]],
   ]],
   arguments = {
   arguments = {
-    image = {
-      type = 'Image',
-      description = 'The image to copy to the texture.'
+    source = {
+      type = 'Texture | Image',
+      description = 'The source texture or image to copy to this texture.'
     },
     },
     texture = {
     texture = {
       type = 'Texture',
       type = 'Texture',
@@ -107,11 +107,7 @@ return {
   returns = {},
   returns = {},
   variants = {
   variants = {
     {
     {
-      arguments = { 'image', 'dstx', 'dsty', 'dstlayer', 'dstmipmap', 'srcx', 'srcy', 'srclayer', 'srcmipmap', 'width', 'height', 'layers' },
-      returns = {}
-    },
-    {
-      arguments = { 'texture', 'dstx', 'dsty', 'dstlayer', 'dstmipmap', 'srcx', 'srcy', 'srclayer', 'srcmipmap', 'width', 'height', 'layers', 'srcwidth', 'srcheight', 'srcdepth', 'filter' },
+      arguments = { 'source', 'dstx', 'dsty', 'dstlayer', 'dstmipmap', 'srcx', 'srcy', 'srclayer', 'srcmipmap', 'width', 'height', 'layers' },
       returns = {}
       returns = {}
     }
     }
   },
   },

+ 1 - 1
api/lovr/headset/Layer/setColor.lua

@@ -24,7 +24,7 @@ return {
       description = 'The alpha component of the color.'
       description = 'The alpha component of the color.'
     },
     },
     t = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A table of 3 or 4 color components.'
       description = 'A table of 3 or 4 color components.'
     },
     },
     hex = {
     hex = {

+ 1 - 1
api/lovr/headset/getAxis.lua

@@ -19,7 +19,7 @@ return {
   },
   },
   returns = {
   returns = {
     ['...'] = {
     ['...'] = {
-      type = 'number',
+      type = 'number | nil',
       description = [[
       description = [[
         The current state of the components of the axis, or `nil` if the device does not have any
         The current state of the components of the axis, or `nil` if the device does not have any
         information about the axis.
         information about the axis.

+ 1 - 0
api/lovr/headset/getBoundsDepth.lua

@@ -15,6 +15,7 @@ return {
       returns = { 'depth' }
       returns = { 'depth' }
     }
     }
   },
   },
+  notes = 'If the VR system is not roomscale, this will return zero.',
   related = {
   related = {
     'lovr.headset.getBoundsWidth',
     'lovr.headset.getBoundsWidth',
     'lovr.headset.getBoundsDimensions'
     'lovr.headset.getBoundsDimensions'

+ 1 - 0
api/lovr/headset/getBoundsDimensions.lua

@@ -19,6 +19,7 @@ return {
       returns = { 'width', 'depth' }
       returns = { 'width', 'depth' }
     }
     }
   },
   },
+  notes = 'If the VR system is not roomscale, this will return zero.',
   related = {
   related = {
     'lovr.headset.getBoundsWidth',
     'lovr.headset.getBoundsWidth',
     'lovr.headset.getBoundsDepth',
     'lovr.headset.getBoundsDepth',

+ 1 - 0
api/lovr/headset/getBoundsWidth.lua

@@ -15,6 +15,7 @@ return {
       returns = { 'width' }
       returns = { 'width' }
     }
     }
   },
   },
+  notes = 'If the VR system is not roomscale, this will return zero.',
   related = {
   related = {
     'lovr.headset.getBoundsDepth',
     'lovr.headset.getBoundsDepth',
     'lovr.headset.getBoundsDimensions'
     'lovr.headset.getBoundsDimensions'

+ 1 - 1
api/lovr/headset/getHands.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     hands = {
     hands = {
-      type = 'table',
+      type = '{Device}',
       arguments = {},
       arguments = {},
       returns = {},
       returns = {},
       description = 'The currently tracked hand devices.'
       description = 'The currently tracked hand devices.'

+ 1 - 1
api/lovr/headset/getLayers.lua

@@ -8,7 +8,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     layers = {
     layers = {
-      type = 'table',
+      type = '{Layer}',
       description = 'The list of layers.'
       description = 'The list of layers.'
     }
     }
   },
   },

+ 1 - 2
api/lovr/headset/getName.lua

@@ -17,6 +17,5 @@ return {
       arguments = {},
       arguments = {},
       returns = { 'name' }
       returns = { 'name' }
     }
     }
-  },
-  notes = 'When headset simulator is used this function returns `nil`.'
+  }
 }
 }

+ 1 - 1
api/lovr/headset/getPass.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     pass = {
     pass = {
-      type = 'Pass',
+      type = 'Pass | nil',
       description = 'The pass.'
       description = 'The pass.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/headset/getRefreshRate.lua

@@ -5,7 +5,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     rate = {
     rate = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The refresh rate of the display, or `nil` if I have no idea what it is.'
       description = 'The refresh rate of the display, or `nil` if I have no idea what it is.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/headset/getRefreshRates.lua

@@ -7,7 +7,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     rates = {
     rates = {
-      type = 'table',
+      type = 'table | nil',
       description = [[
       description = [[
         A flat table of the refresh rates supported by the headset display, or nil if not supported.
         A flat table of the refresh rates supported by the headset display, or nil if not supported.
       ]]
       ]]

+ 1 - 1
api/lovr/headset/getSkeleton.lua

@@ -17,7 +17,7 @@ return {
   },
   },
   returns = {
   returns = {
     transforms = {
     transforms = {
-      type = 'table',
+      type = '{{number}} | nil',
       description = [[
       description = [[
         A list of joint transforms for the device.  Each transform is a table with 3 numbers for the
         A list of joint transforms for the device.  Each transform is a table with 3 numbers for the
         position of the joint, 1 number for the joint radius (in meters), and 4 numbers for the
         position of the joint, 1 number for the joint radius (in meters), and 4 numbers for the

+ 1 - 1
api/lovr/headset/getTexture.lua

@@ -9,7 +9,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     texture = {
     texture = {
-      type = 'Texture',
+      type = 'Texture | nil',
       description = 'The headset texture.'
       description = 'The headset texture.'
     }
     }
   },
   },

+ 4 - 4
api/lovr/headset/getViewAngles.lua

@@ -16,19 +16,19 @@ return {
   },
   },
   returns = {
   returns = {
     left = {
     left = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The left view angle, in radians.'
       description = 'The left view angle, in radians.'
     },
     },
     right = {
     right = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The right view angle, in radians.'
       description = 'The right view angle, in radians.'
     },
     },
     top = {
     top = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The top view angle, in radians.'
       description = 'The top view angle, in radians.'
     },
     },
     bottom = {
     bottom = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The bottom view angle, in radians.'
       description = 'The bottom view angle, in radians.'
     }
     }
   },
   },

+ 7 - 7
api/lovr/headset/getViewPose.lua

@@ -15,31 +15,31 @@ return {
   },
   },
   returns = {
   returns = {
     x = {
     x = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The x coordinate of the view position, in meters.'
       description = 'The x coordinate of the view position, in meters.'
     },
     },
     y = {
     y = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The y coordinate of the view position, in meters.'
       description = 'The y coordinate of the view position, in meters.'
     },
     },
     z = {
     z = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The z coordinate of the view position, in meters.'
       description = 'The z coordinate of the view position, in meters.'
     },
     },
     angle = {
     angle = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The amount of rotation around the rotation axis, in radians.'
       description = 'The amount of rotation around the rotation axis, in radians.'
     },
     },
     ax = {
     ax = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The x component of the axis of rotation.'
       description = 'The x component of the axis of rotation.'
     },
     },
     ay = {
     ay = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The y component of the axis of rotation.'
       description = 'The y component of the axis of rotation.'
     },
     },
     az = {
     az = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The z component of the axis of rotation.'
       description = 'The z component of the axis of rotation.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/headset/isDown.lua

@@ -14,7 +14,7 @@ return {
   },
   },
   returns = {
   returns = {
     down = {
     down = {
-      type = 'boolean',
+      type = 'boolean | nil',
       description = [[
       description = [[
         Whether the button on the device is currently pressed, or `nil` if the device does not have
         Whether the button on the device is currently pressed, or `nil` if the device does not have
         the specified button.
         the specified button.

+ 1 - 1
api/lovr/headset/isTouched.lua

@@ -14,7 +14,7 @@ return {
   },
   },
   returns = {
   returns = {
     touched = {
     touched = {
-      type = 'boolean',
+      type = 'boolean | nil',
       description = [[
       description = [[
         Whether the button on the device is currently touched, or `nil` if the device does not have
         Whether the button on the device is currently touched, or `nil` if the device does not have
         the button or it isn't touch-sensitive.
         the button or it isn't touch-sensitive.

+ 7 - 30
api/lovr/headset/setBackground.lua

@@ -11,44 +11,21 @@ return {
     tracked smoothly even if LÖVR is struggling to render at a high frame rate.
     tracked smoothly even if LÖVR is struggling to render at a high frame rate.
   ]],
   ]],
   arguments = {
   arguments = {
-    texture = {
-      type = 'Texture',
+    background = {
+      type = 'Image | {Image} | Texture',
       description = [[
       description = [[
-        The Texture to use for the background.  It can be a `cube` texture which will be rendered as
-        a cubemap, or a `2d` texture interpreted as equirectangular (sometimes called panoramic or
-        spherical) coordinates.
+        The image(s) or texture to use for the background.  Backgrounds can either be cubemaps (6
+        images) or equirectangular (a single panoramic 2D image).
 
 
-        The texture can have any color format, but it will be converted to `rgba8` before getting
-        copied to the VR runtime.
-      ]]
-    },
-    image = {
-      type = 'Image',
-      description = [[
-        The Image to use for the background.  It can have 1 layer for an equirectangular background,
-        or 6 layers for a cubemap.  Currently, it must have a format of `rgba8`.
-      ]]
-    },
-    images = {
-      type = 'table',
-      description = [[
-        A table of 1 or 6 images to use for the background.  They must be the same size and they
-        currently must use the `rgba8` format.
+        Textures can have any color format, but it will be converted to `rgba8` before getting
+        copied to the VR runtime.  Images currently have to be `rgba8`.
       ]]
       ]]
     }
     }
   },
   },
   returns = {},
   returns = {},
   variants = {
   variants = {
     {
     {
-      arguments = { 'texture' },
-      returns = {}
-    },
-    {
-      arguments = { 'image' },
-      returns = {}
-    },
-    {
-      arguments = { 'images' },
+      arguments = { 'background' },
       returns = {}
       returns = {}
     },
     },
     {
     {

+ 1 - 6
api/lovr/headset/wasPressed.lua

@@ -24,12 +24,7 @@ return {
       returns = { 'pressed' }
       returns = { 'pressed' }
     }
     }
   },
   },
-  notes = [[
-    Some headset backends are not able to return pressed/released information.  These drivers will
-    always return false for `lovr.headset.wasPressed` and `lovr.headset.wasReleased`.
-
-    Typically the internal `lovr.headset.update` function will update pressed/released status.
-  ]],
+  notes = 'The internal `lovr.headset.update` function updates pressed/released status.',
   related = {
   related = {
     'DeviceButton',
     'DeviceButton',
     'lovr.headset.isDown',
     'lovr.headset.isDown',

+ 1 - 1
api/lovr/math/Curve/render.lua

@@ -23,7 +23,7 @@ return {
   },
   },
   returns = {
   returns = {
     t = {
     t = {
-      type = 'table',
+      type = '{number}',
       description = 'A (flat) table of 3D points along the curve.'
       description = 'A (flat) table of 3D points along the curve.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/math/gammaToLinear.lua

@@ -16,7 +16,7 @@ return {
       description = 'The blue component of the gamma-space color.'
       description = 'The blue component of the gamma-space color.'
     },
     },
     color = {
     color = {
-      type = 'table',
+      type = '{number}',
       description = 'A table containing the components of a gamma-space color.'
       description = 'A table containing the components of a gamma-space color.'
     },
     },
     x = {
     x = {

+ 1 - 1
api/lovr/math/linearToGamma.lua

@@ -16,7 +16,7 @@ return {
       description = 'The blue component of the linear-space color.'
       description = 'The blue component of the linear-space color.'
     },
     },
     color = {
     color = {
-      type = 'table',
+      type = '{number}',
       description = 'A table containing the components of a linear-space color.'
       description = 'A table containing the components of a linear-space color.'
     },
     },
     x = {
     x = {

+ 5 - 3
api/lovr/physics/Collider/getShape.lua

@@ -10,8 +10,11 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     shape = {
     shape = {
-      type = 'Shape',
-      description = 'One of the `Shape` objects attached to the Collider.'
+      type = 'Shape | nil',
+      description = [[
+        One of the `Shape` objects attached to the Collider, or `nil` if the Collider doesn't have
+        any shapes attached to it.
+      ]]
     }
     }
   },
   },
   variants = {
   variants = {
@@ -20,7 +23,6 @@ return {
       returns = { 'shape' }
       returns = { 'shape' }
     }
     }
   },
   },
-  notes = 'This may return `nil` if the Collider doesn\'t have any shapes attached to it.',
   example = [[
   example = [[
     function drawBoxCollider(pass, collider)
     function drawBoxCollider(pass, collider)
       local position = vec3(collider:getPosition())
       local position = vec3(collider:getPosition())

+ 1 - 1
api/lovr/physics/Collider/getTag.lua

@@ -12,7 +12,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     tag = {
     tag = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The Collider\'s tag.'
       description = 'The Collider\'s tag.'
     }
     }
   },
   },

+ 2 - 0
api/lovr/physics/Collider/setDegreesOfFreedom.lua

@@ -4,6 +4,7 @@ return {
   arguments = {
   arguments = {
     translation = {
     translation = {
       type = 'string',
       type = 'string',
+      default = [['']],
       description = [[
       description = [[
         A string containing the world-space axes the Collider is allowed to move on.  The string
         A string containing the world-space axes the Collider is allowed to move on.  The string
         should have 'x', 'y', and 'z' letters representing the axes to enable.  Use nil or an empty
         should have 'x', 'y', and 'z' letters representing the axes to enable.  Use nil or an empty
@@ -12,6 +13,7 @@ return {
     },
     },
     rotation = {
     rotation = {
       type = 'string',
       type = 'string',
+      default = [['']],
       description = [[
       description = [[
         A string containing the world-space axes the Collider is allowed to rotate on.  The string
         A string containing the world-space axes the Collider is allowed to rotate on.  The string
         should have 'x', 'y', and 'z' letters representing the axes to enable.  Use nil or an empty
         should have 'x', 'y', and 'z' letters representing the axes to enable.  Use nil or an empty

+ 1 - 1
api/lovr/physics/Shape/raycast.lua

@@ -66,7 +66,7 @@ return {
       description = 'The z component of the normal vector.'
       description = 'The z component of the normal vector.'
     },
     },
     triangle = {
     triangle = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The index of the triangle that was hit, or `nil` if this is not a MeshShape.'
       description = 'The index of the triangle that was hit, or `nil` if this is not a MeshShape.'
     }
     }
   },
   },

+ 4 - 4
api/lovr/physics/World/getCallbacks.lua

@@ -12,22 +12,22 @@ return {
       table = {
       table = {
         {
         {
           name = 'filter',
           name = 'filter',
-          type = 'function',
+          type = 'function | nil',
           description = 'The function used to filter collisions.'
           description = 'The function used to filter collisions.'
         },
         },
         {
         {
           name = 'enter',
           name = 'enter',
-          type = 'function',
+          type = 'function | nil',
           description = 'The function called when 2 colliders start touching.'
           description = 'The function called when 2 colliders start touching.'
         },
         },
         {
         {
           name = 'exit',
           name = 'exit',
-          type = 'function',
+          type = 'function | nil',
           description = 'The function called when 2 colliders stop touching.'
           description = 'The function called when 2 colliders stop touching.'
         },
         },
         {
         {
           name = 'contact',
           name = 'contact',
-          type = 'function',
+          type = 'function | nil',
           description = 'The function called every frame while 2 colliders are in contact.'
           description = 'The function called every frame while 2 colliders are in contact.'
         }
         }
       }
       }

+ 1 - 1
api/lovr/physics/World/getColliders.lua

@@ -6,7 +6,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     colliders = {
     colliders = {
-      type = 'table',
+      type = '{Collider}',
       description = 'The list of `Collider` objects in the World.'
       description = 'The list of `Collider` objects in the World.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/physics/World/getJoints.lua

@@ -6,7 +6,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     joints = {
     joints = {
-      type = 'table',
+      type = '{Joint}',
       description = 'The list of `Joint` objects in the World.'
       description = 'The list of `Joint` objects in the World.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/physics/World/getTags.lua

@@ -8,7 +8,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     tags = {
     tags = {
-      type = 'table',
+      type = '{string}',
       description = 'A table of collision tags (strings).'
       description = 'A table of collision tags (strings).'
     }
     }
   },
   },

+ 1 - 0
api/lovr/physics/World/overlapShape.lua

@@ -71,6 +71,7 @@ return {
     },
     },
     callback = {
     callback = {
       type = 'function',
       type = 'function',
+      default = 'nil',
       description = 'The callback to call for each intersection detected.'
       description = 'The callback to call for each intersection detected.'
     }
     }
   },
   },

+ 1 - 0
api/lovr/physics/World/queryBox.lua

@@ -53,6 +53,7 @@ return {
     },
     },
     callback = {
     callback = {
       type = 'function',
       type = 'function',
+      default = 'nil',
       description = [[
       description = [[
         A function to call when a collider is detected.  The function will be called with a single
         A function to call when a collider is detected.  The function will be called with a single
         `Collider` argument.
         `Collider` argument.

+ 1 - 0
api/lovr/physics/World/querySphere.lua

@@ -41,6 +41,7 @@ return {
     },
     },
     callback = {
     callback = {
       type = 'function',
       type = 'function',
+      default = 'nil',
       description = [[
       description = [[
         A function to call when an intersection is detected.  The function will be called with a
         A function to call when an intersection is detected.  The function will be called with a
         single `Collider` argument.
         single `Collider` argument.

+ 2 - 1
api/lovr/physics/World/raycast.lua

@@ -48,6 +48,7 @@ return {
     },
     },
     callback = {
     callback = {
       type = 'function',
       type = 'function',
+      default = 'nil',
       arguments = {
       arguments = {
         {
         {
           name = 'collider',
           name = 'collider',
@@ -134,7 +135,7 @@ return {
       description = 'The z component of the normal vector.'
       description = 'The z component of the normal vector.'
     },
     },
     triangle = {
     triangle = {
-      type = 'number',
+      type = 'number | nil',
       description = 'The index of the triangle that was hit, or nil if a MeshShape was not hit.'
       description = 'The index of the triangle that was hit, or nil if a MeshShape was not hit.'
     }
     }
   },
   },

+ 1 - 1
api/lovr/physics/World/setCallbacks.lua

@@ -33,7 +33,7 @@ return {
   arguments = {
   arguments = {
     callbacks = {
     callbacks = {
       type = 'table',
       type = 'table',
-      description = 'The World collision callbacks.',
+      description = 'The World collision callbacks.  All of them are optional.',
       table = {
       table = {
         {
         {
           name = 'filter',
           name = 'filter',

+ 4 - 20
api/lovr/physics/newConvexShape.lua

@@ -9,17 +9,9 @@ return {
         numbers) or a table of numbers (every 3 numbers form a 3D point).
         numbers) or a table of numbers (every 3 numbers form a 3D point).
       ]]
       ]]
     },
     },
-    modelData = {
-      type = 'ModelData',
-      description = 'The ModelData to compute a convex hull from.'
-    },
-    model = {
-      type = 'Model',
-      description = 'The Model to compute a convex hull from.'
-    },
-    mesh = {
-      type = 'Mesh',
-      description = 'The Mesh to compute a convex hull from.  It must use the `cpu` storage mode.'
+    object = {
+      type = 'ModelData | Model | Mesh',
+      description = 'An object to use for the points of the convex hull.'
     },
     },
     template = {
     template = {
       type = 'ConvexShape',
       type = 'ConvexShape',
@@ -43,15 +35,7 @@ return {
       returns = { 'shape' }
       returns = { 'shape' }
     },
     },
     {
     {
-      arguments = { 'modelData', 'scale' },
-      returns = { 'shape' }
-    },
-    {
-      arguments = { 'model', 'scale' },
-      returns = { 'shape' }
-    },
-    {
-      arguments = { 'mesh', 'scale' },
+      arguments = { 'object', 'scale' },
       returns = { 'shape' }
       returns = { 'shape' }
     },
     },
     {
     {

+ 4 - 23
api/lovr/physics/newMeshShape.lua

@@ -12,20 +12,9 @@ return {
         A table of triangle indices representing how the vertices are connected in the Mesh.
         A table of triangle indices representing how the vertices are connected in the Mesh.
       ]]
       ]]
     },
     },
-    modelData = {
-      type = 'ModelData',
-      description = 'The ModelData to use the vertices from.'
-    },
-    model = {
-      type = 'Model',
-      description = [[
-        A Model to use for the mesh data.  Similar to calling `Model:getTriangles` and passing it to
-        this function, but has better performance.
-      ]]
-    },
-    mesh = {
-      type = 'Mesh',
-      description = 'The Mesh to use the vertices from.  It must use the `cpu` storage mode.'
+    object = {
+      type = 'ModelData | Model | Mesh',
+      description = 'An object to use the triangles from.  Meshes must use the `cpu` storage mode.'
     },
     },
     template = {
     template = {
       type = 'MeshShape',
       type = 'MeshShape',
@@ -49,15 +38,7 @@ return {
       returns = { 'mesh' }
       returns = { 'mesh' }
     },
     },
     {
     {
-      arguments = { 'modelData', 'scale' },
-      returns = { 'mesh' }
-    },
-    {
-      arguments = { 'model', 'scale' },
-      returns = { 'mesh' }
-    },
-    {
-      arguments = { 'mesh', 'scale' },
+      arguments = { 'object', 'scale' },
       returns = { 'mesh' }
       returns = { 'mesh' }
     },
     },
     {
     {

+ 2 - 2
api/lovr/system/getClipboardText.lua

@@ -5,8 +5,8 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     text = {
     text = {
-      type = 'string',
-      description = 'The clipboard text (may be nil).'
+      type = 'string | nil',
+      description = 'The clipboard text.'
     }
     }
   },
   },
   variants = {
   variants = {

+ 1 - 1
api/lovr/thread/Channel/pop.lua

@@ -6,7 +6,7 @@ return {
   ]],
   ]],
   arguments = {
   arguments = {
     wait = {
     wait = {
-      type = 'number',
+      type = 'number | boolean',
       default = 'false',
       default = 'false',
       description = [[
       description = [[
         How long to wait for a message to be popped, in seconds.  `true` can be used to wait forever
         How long to wait for a message to be popped, in seconds.  `true` can be used to wait forever

+ 1 - 1
api/lovr/thread/Channel/push.lua

@@ -10,7 +10,7 @@ return {
       description = 'The message to push.'
       description = 'The message to push.'
     },
     },
     wait = {
     wait = {
-      type = 'number',
+      type = 'number | boolean',
       default = 'false',
       default = 'false',
       description = [[
       description = [[
         How long to wait for the message to be popped, in seconds.  `true` can be used to wait
         How long to wait for the message to be popped, in seconds.  `true` can be used to wait

+ 1 - 1
api/lovr/thread/Thread/getError.lua

@@ -6,7 +6,7 @@ return {
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     error = {
     error = {
-      type = 'string',
+      type = 'string | nil',
       description = 'The error message, or `nil` if no error has occurred on the Thread.'
       description = 'The error message, or `nil` if no error has occurred on the Thread.'
     }
     }
   },
   },

+ 4 - 1
api/lovr/thread/Thread/start.lua

@@ -14,7 +14,10 @@ return {
       returns = {}
       returns = {}
     }
     }
   },
   },
-  notes = 'The arguments can be nil, booleans, numbers, strings, or LÖVR objects.',
+  notes = [[
+    The arguments can be nil, booleans, numbers, strings, lightuserdata, tables, vectors, or LÖVR
+    objects.
+  ]],
   example = [=[
   example = [=[
     function lovr.load()
     function lovr.load()
       lovr.thread.newThread([[
       lovr.thread.newThread([[

+ 4 - 12
api/lovr/thread/newThread.lua

@@ -6,13 +6,9 @@ return {
       type = 'string',
       type = 'string',
       description = 'The code to run in the Thread.'
       description = 'The code to run in the Thread.'
     },
     },
-    filename = {
-      type = 'string',
-      description = 'A file containing code to run in the Thread.'
-    },
-    blob = {
-      type = 'Blob',
-      description = 'The code to run in the Thread.'
+    file = {
+      type = 'string | Blob',
+      description = 'A filename or Blob containing code to run in the Thread.'
     }
     }
   },
   },
   returns = {
   returns = {
@@ -27,11 +23,7 @@ return {
       returns = { 'thread' }
       returns = { 'thread' }
     },
     },
     {
     {
-      arguments = { 'filename' },
-      returns = { 'thread' }
-    },
-    {
-      arguments = { 'blob' },
+      arguments = { 'file' },
       returns = { 'thread' }
       returns = { 'thread' }
     }
     }
   },
   },

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно