title: How to get Luaj function parameter names inside java class?
body: <p>Is there any way to get the count and names of all the function parameters defined in .lua file?</p>
  
  <p>For eg my test1.lua is</p>
  
  <pre><code>function MyAdd( num1, num2, num3)
      local x = 0
      if(num1 &lt;= num2) then
          x = num1 + num2 + num3 
      else
          x = (num1 - num2) + num3     
      end
      return x
  end
  </code></pre>
  
  <p>And inside Java class I am trying to execute this function by passing parameter values. </p>
  
  <p>If this Lua function was written by some other user and saved into a folder and the java application loaded this Lua file without knowing what function is inside it. How can I get the name of the function ('MyAdd'), the number of input parameters to this function and also the name of these input Parameters (num1, num2 and num3) inside java</p>
  
  <p>If I know the name of the function and number and order of input parameters I can invoke the function as below.</p>
  
  <pre><code>public static void main(String[] args) {
  
      int a1 = 5;
      int a2 = 10;
      int a3 = 15;
  
      Globals globals = JsePlatform.standardGlobals();
      globals.get("dofile").call(LuaValue.valueOf("./luascripts/test1.lua"));
  
          LuaValue MyAdd = globals.get("MyAdd"); 
  
          Varargs results = MyAdd.invoke(LuaValue.varargsOf(new LuaValue 
               [] {LuaValue.valueOf(a3), LuaValue.valueOf(a1), LuaValue.valueOf
                   (a2)}));
          System.out.println(results);
  }
  </code></pre>
  
  <p>I hope I made myself clear about what am I trying to achieve. Any help is appreciated.</p>