bjorn 1 viikko sitten
vanhempi
commit
a9560a93c7
2 muutettua tiedostoa jossa 65 lisäystä ja 0 poistoa
  1. 60 0
      api/init.lua
  2. 5 0
      api/lovr/init.lua

+ 60 - 0
api/init.lua

@@ -1191,6 +1191,11 @@ return {
           tag = "version",
           description = "This function returns the current version of LÖVR."
         },
+        {
+          name = "Vector Math",
+          tag = "vectors",
+          description = "LÖVR has a few extra libraries to make vector math easier."
+        },
         {
           name = "Libraries",
           tag = "libraries",
@@ -42927,6 +42932,61 @@ return {
       },
       objects = {}
     },
+    {
+      name = "vector",
+      tag = "vectors",
+      summary = "3D vector type.",
+      description = "TODO",
+      key = "lovr.vector",
+      enums = {},
+      functions = {
+        {
+          name = "pack",
+          summary = "Pack numbers into a vector.",
+          description = "Packs numbers into a vector.",
+          key = "lovr.vector.pack",
+          module = "lovr.vector",
+          examples = {
+            {
+              code = "local a = vector.pack(1, 2, 3)\nlocal b = vector.pack(5)\nprint(a + b) --> 6, 7, 8\n\n-- put the 3 numbers from lovr.headset.getPosition into a vector!\nlocal position = vector(lovr.headset.getPosition())"
+            }
+          },
+          notes = "As a shortcut, the `vector` library can be called like a function, which calls this function:\n\n    vector(x, y, z) -- same as vector.pack(x, y, z)",
+          variants = {
+            {
+              arguments = {
+                {
+                  name = "x",
+                  type = "number",
+                  description = "The x component of the vector.",
+                  default = "0"
+                },
+                {
+                  name = "y",
+                  type = "number",
+                  description = "The y component of the vector.",
+                  default = "x"
+                },
+                {
+                  name = "z",
+                  type = "number",
+                  description = "The z component of the vector.",
+                  default = "z"
+                }
+              },
+              returns = {
+                {
+                  name = "v",
+                  type = "vector",
+                  description = "The new vector."
+                }
+              }
+            }
+          }
+        }
+      },
+      objects = {}
+    },
     {
       name = "utf8",
       tag = "libraries",

+ 5 - 0
api/lovr/init.lua

@@ -30,6 +30,11 @@ return {
       tag = 'version',
       description = 'This function returns the current version of LÖVR.'
     },
+    {
+      name = 'Vector Math',
+      tag = 'vectors',
+      description = 'LÖVR has a few extra libraries to make vector math easier.'
+    },
     {
       name = 'Libraries',
       tag = 'libraries',