JavaScript functions can be variadic, so there is no well to tell in that case.
However, for normally defined javascript functions that name their
parameters, you can access the length parameter on the function. For
example
function blah(a, b, c) { }
print(blah.length); // Prints 3.
If you are defining the function on the C++ side, then you should set
the appropriate length.
On Sat, Aug 22, 2009 at 7:30 AM, SaiaGo <[email protected]> wrote:
>
> I'm trying to make some kind of a console for a game.
> For commands I use JavaScript functions. If, for example, a user types
> "say hello" into the console, it will search for a JavaScript function
> called "say" and pass "hello" as an argument. I got it to execute the
> correct function if it exists, and print an error message if such a
> function doesn't exist. If I type a command with the appropriate
> amount of arguments it works just fine.
> My problem begins when I want to make a command with no arguments or
> more than one argument. I can't find a way to get the number of
> arguments a function should receive, and if possible, the argument
> names.
>
> Is such a thing possible. And if it is, how should it be achieved?
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---