Accessing individual parameters (a.k.a skipping some)

This seems like it would be easy or not possible, and I can't figure out which. :x

I have a number of handlers with parameters. I understand that I have the option to only send the first parameter. Also, if I send extra parameters, they will get ignored (Technically, passed through?). But is there a way I can send only the 2nd and 4th of 6 parameters?

I can post an example if it's not clear what I'm asking.

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    It's generally not a good coding practice to make anything but the last parameters optional. But yes, you can pass whatever parameters you'd like by leaving empty spaces in the list:
    myHandler , "second", , , , "sixth"
    
    to myHandler
          put params() -- outputs myhandler "","second","","","","sixth"
          put parameterList() -- outputs (,second,,,,sixth)
    end myHandler
    
    You can also explicitly pass the value "empty" to make it easier to count how many parameters you're passing:
    myHandler empty, "second", empty, empty, empty, "sixth"
    
  • brett_xbrett_x Member
    That's what I was looking for. I may end up breaking some of these handlers down further into "required" and "optional" entries for the stuff we're doing.

    Thanks for the quick reply.
Sign In or Register to comment.