JavaScript is required to use Bungie.net

Forums

originally posted in: Retrieve function body as string
1/29/2013 7:43:39 AM
2
Now can you get it to return the arguments that were past to the function?
English

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Edited by dazarobbo: 1/29/2013 8:14:46 AM
    [quote]function Foobar(foo, bar){ return Array.prototype.slice.call(arguments); } alert(Foobar("I am foo", "I am bar"));[/quote] Unless you want them as an array from the function definition. [quote]Object.defineProperty(Function.prototype, "Args", { get: function(){ return /function [^\(]*\((.*)\)/i.exec(this.toString())[1].split(/\s*,\s*/); } }); var foobarArgs = Foobar.Args;[/quote]

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Nice! You're the Man.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

You are not allowed to view this content.
;
preload icon
preload icon
preload icon