Bladeren bron

Add checks for missing variant items;

bjorn 3 jaren geleden
bovenliggende
commit
1b37f06c1f

+ 119 - 12
api/init.lua

@@ -5027,7 +5027,13 @@ return {
                       description = "The index of the parent node."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "children",
+                      type = "table",
+                      description = "A table containing a node index for each child of the node."
+                    }
+                  }
                 },
                 {
                   arguments = {
@@ -5037,7 +5043,13 @@ return {
                       description = "The name of the parent node."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "children",
+                      type = "table",
+                      description = "A table containing a node index for each child of the node."
+                    }
+                  }
                 }
               },
               notes = "If the node does not have any children, this function returns an empty table."
@@ -8277,6 +8289,11 @@ return {
                   name = "stage",
                   type = "ShaderStage",
                   description = "TODO"
+                },
+                {
+                  name = "source",
+                  type = "ShaderSource",
+                  description = "TODO"
                 }
               },
               returns = {
@@ -9610,7 +9627,13 @@ return {
                   description = "TODO"
                 }
               },
-              returns = {}
+              returns = {
+                {
+                  name = "pass",
+                  type = "Pass",
+                  description = "The new Pass."
+                }
+              }
             },
             {
               arguments = {
@@ -9625,7 +9648,13 @@ return {
                   description = "TODO"
                 }
               },
-              returns = {}
+              returns = {
+                {
+                  name = "pass",
+                  type = "Pass",
+                  description = "The new Pass."
+                }
+              }
             },
             {
               arguments = {
@@ -9663,7 +9692,13 @@ return {
                   }
                 }
               },
-              returns = {}
+              returns = {
+                {
+                  name = "pass",
+                  type = "Pass",
+                  description = "The new Pass."
+                }
+              }
             }
           }
         },
@@ -10265,7 +10300,13 @@ return {
           },
           variants = {
             {
-              arguments = {},
+              arguments = {
+                {
+                  name = "...",
+                  type = "Pass",
+                  description = "The pass objects to submit.  Falsy values will be skipped."
+                }
+              },
               returns = {
                 {
                   name = "true",
@@ -10275,7 +10316,13 @@ return {
               }
             },
             {
-              arguments = {},
+              arguments = {
+                {
+                  name = "t",
+                  type = "table",
+                  description = "A table of passes to submit.  Falsy values will be skipped."
+                }
+              },
               returns = {
                 {
                   name = "true",
@@ -10971,6 +11018,12 @@ return {
                       name = "time",
                       type = "number",
                       description = "The timestamp to evaluate the keyframes at, in seconds."
+                    },
+                    {
+                      name = "blend",
+                      type = "number",
+                      description = "How much of the animation's pose to blend into the nodes, from 0 to 1.",
+                      default = "1.0"
                     }
                   },
                   returns = {}
@@ -10986,6 +11039,12 @@ return {
                       name = "time",
                       type = "number",
                       description = "The timestamp to evaluate the keyframes at, in seconds."
+                    },
+                    {
+                      name = "blend",
+                      type = "number",
+                      description = "How much of the animation's pose to blend into the nodes, from 0 to 1.",
+                      default = "1.0"
                     }
                   },
                   returns = {}
@@ -11497,7 +11556,13 @@ return {
                       description = "The index of the parent node."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "children",
+                      type = "table",
+                      description = "A table containing a node index for each child of the node."
+                    }
+                  }
                 },
                 {
                   arguments = {
@@ -11507,7 +11572,13 @@ return {
                       description = "The name of the parent node."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "children",
+                      type = "table",
+                      description = "A table containing a node index for each child of the node."
+                    }
+                  }
                 }
               },
               notes = "If the node does not have any children, this function returns an empty table."
@@ -13110,6 +13181,12 @@ return {
                       type = "number",
                       description = "The index of the first mipmap level to clear.",
                       default = "1"
+                    },
+                    {
+                      name = "levels",
+                      type = "number",
+                      description = "The number of mipmap level to clear.",
+                      default = "nil"
                     }
                   },
                   returns = {}
@@ -14227,7 +14304,25 @@ return {
               module = "lovr.graphics",
               variants = {
                 {
-                  arguments = {},
+                  arguments = {
+                    {
+                      name = "texture",
+                      type = "Texture",
+                      description = "TODO"
+                    },
+                    {
+                      name = "base",
+                      type = "number",
+                      description = "TODO",
+                      default = "0"
+                    },
+                    {
+                      name = "count",
+                      type = "number",
+                      description = "TODO",
+                      default = "nil"
+                    }
+                  },
                   returns = {}
                 }
               }
@@ -16402,7 +16497,13 @@ return {
                       description = "The name of an attribute."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "exists",
+                      type = "boolean",
+                      description = "Whether the Shader has the attribute."
+                    }
+                  }
                 },
                 {
                   arguments = {
@@ -16412,7 +16513,13 @@ return {
                       description = "The location of an attribute."
                     }
                   },
-                  returns = {}
+                  returns = {
+                    {
+                      name = "exists",
+                      type = "boolean",
+                      description = "Whether the Shader has the attribute."
+                    }
+                  }
                 }
               }
             },

+ 3 - 3
api/lovr/data/ModelData/getNodeChildren.lua

@@ -14,9 +14,9 @@ return {
     }
   },
   returns = {
-    parent = {
-      type = 'number',
-      description = 'The index of the node\'s parent.'
+    children = {
+      type = 'table',
+      description = 'A table containing a node index for each child of the node.'
     }
   },
   variants = {

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

@@ -23,11 +23,11 @@ return {
   returns = {},
   variants = {
     {
-      arguments = { 'name', 'time', 'alpha' },
+      arguments = { 'name', 'time', 'blend' },
       returns = {}
     },
     {
-      arguments = { 'index', 'time', 'alpha' },
+      arguments = { 'index', 'time', 'blend' },
       returns = {}
     }
   },

+ 3 - 3
api/lovr/graphics/Model/getNodeChildren.lua

@@ -14,9 +14,9 @@ return {
     }
   },
   returns = {
-    parent = {
-      type = 'number',
-      description = 'The index of the node\'s parent.'
+    children = {
+      type = 'table',
+      description = 'A table containing a node index for each child of the node.'
     }
   },
   variants = {

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

@@ -38,7 +38,7 @@ return {
        default = '1',
        description = 'The index of the first mipmap level to clear.'
      },
-     levelCount = {
+     levels = {
        type = 'number',
        default = 'nil',
        description = 'The number of mipmap level to clear.'

+ 1 - 7
api/lovr/graphics/Pass/mipmap.lua

@@ -21,11 +21,5 @@ return {
       description = 'TODO'
     }
   },
-  returns = {},
-  variants = {
-    {
-      arguments = { 'texture', 'base', 'count' },
-      returns = {}
-    }
-  }
+  returns = {}
 }

+ 1 - 2
api/lovr/graphics/Shader/hasAttribute.lua

@@ -12,8 +12,7 @@ return {
     }
   },
   returns = {
-    present = {
-      name = 'exists',
+    exists = {
       type = 'boolean',
       description = 'Whether the Shader has the attribute.'
     }

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

@@ -6,7 +6,7 @@ return {
       type = 'ShaderStage',
       description = 'TODO'
     },
-    string = {
+    source = {
       type = 'ShaderSource',
       description = 'TODO'
     }

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

@@ -40,7 +40,7 @@ return {
     }
   },
   returns = {
-    model = {
+    pass = {
       type = 'Pass',
       description = 'The new Pass.'
     }

+ 7 - 9
api/lovr/graphics/submit.lua

@@ -3,15 +3,13 @@ return {
   summary = 'Submit recorded graphics work to the GPU.',
   description = 'TODO',
   arguments = {
-    {
-      ['...'] = {
-        type = 'Pass',
-        description = 'The pass objects to submit.  Falsy values will be skipped.'
-      },
-      t = {
-        type = 'table',
-        description = 'A table of passes to submit.  Falsy values will be skipped.'
-      }
+    ['...'] = {
+      type = 'Pass',
+      description = 'The pass objects to submit.  Falsy values will be skipped.'
+    },
+    t = {
+      type = 'table',
+      description = 'A table of passes to submit.  Falsy values will be skipped.'
     }
   },
   returns = {

+ 2 - 0
api/main.lua

@@ -114,10 +114,12 @@ local function processFunction(path, parent)
 
     for _, variant in ipairs(fn.variants) do
       for i, name in ipairs(variant.arguments) do
+        assert(fn.arguments[name], string.format('Function %q variant argument %q does not exist', fn.key, name))
         variant.arguments[i] = copy(fn.arguments[name])
       end
 
       for i, name in ipairs(variant.returns) do
+        assert(fn.returns[name], string.format('Function %q variant return %q does not exist', fn.key, name))
         variant.returns[i] = copy(fn.returns[name])
       end
     end