From: Baptiste Lepilleur Date: 2002-04-27T20:41:01+09:00 Subject: Re: extending ruby: defining method with default parameters value... ----- Original Message ----- From: "Joel VanderWerf" To: "ruby-talk ML" Sent: Saturday, April 27, 2002 6:29 AM Subject: Re: extending ruby: defining method with default parameters value... > Baptiste Lepilleur wrote: > > > rb_define_method( ruby_cScintillaBase, > > "sendEditorMessage", > > ruby_sendEditorMessage, > > 3 ); > > > > How do I define default value for parameter 2 & 3 ? Is it even possible > > to do that from C ? > > You can use rb_scan_args. See the "Extending Ruby" chapter of the > pickaxe book, and the README.EXT that came with your Ruby. Note that you > have to use an arg count of -1, so that the args will be passed in a C > array, which you pass to rb_scan_args, along with a format string. Now, I remember reading something about the -1 argument count. Thanks for pointing it out! > > In the CGenerator library in RAA, this is made even easier. When you > define a C function from Ruby, you specify something like Thanks, I'll give a look to that application. It seems to be an interesting source of information. Baptiste.