[email protected] wrote on 06/08/2009 11:16:43 AM:
>
> On Sun, Jun 7, 2009 at 9:53 PM, Wilson Liu wrote:
> >
> > Hi,
> > I am writing a function like
> > function! Print(format, expre ...)
> > "call printf(a:format, ???)
> > endfunction
> > However, I have no idea about how to pass the variable number of
arguments
> > to the printf function.
> > I would like to know how to implement this function.
>
> I'm not sure exactly what you want your new function to do, but...
> the following is a function that does nothing more than wrap the
> existing printf() function.
>
> function! Print(format, ...)
> return call(function("printf"), [ a:format ] + a:000)
> endfunction
>
> The magic is the call() function, and the a:000 variable.
>
> ~Matt
>
> >
Thank you.
I find it an excellent resolution to my problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---