On Friday 06 April 2007 19:53, Melchior FRANZ wrote: > Simpler, yes, though not much. What the code does is similar to > overloading in C++. Two possible argument sets to the same function. > Named args alone wouldn't help here at all. What would help is named > args with default values. But that only works if they are always > used in order, which is not the case here.
I assumed that it was possible to name the arguments when calling the function, like in Python. And that you could then give them in arbitrary order. How do I add a <repeat> argument to the aircraft.light.new method? If I add it before <switch> then that will certainly break things. If I add it after <switch> then <switch> is no longer optional. Another solution would be to set the last element of the pattern to the number of times to repeat the pattern, -1 meaning repeat forever. But that will also break things. Third option is to set the last element in pattern to the negative number of times to repeat. [0.5, 0.5, -3], repeat 3 times. [0.5, 0.5], repeat forever. This avoids breaking stuff. But now it's becoming hairy. :-( -- Roy Vegard Ovesen ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel