5

I have a varargs function, which I want to refactor to include a separate 'argument handling function' first, so that that becomes separately callable. I've read :help function-argument but was unable to discover how to expand a:000, which comes as a list of strings, so that bar can also accept varargs in the same way?

fu! Foo(...) abort
  let s = Bar(a:000[???])
endfunction

1 Answer 1

6

Use :h call():

func! Bar(...) abort
    return a:000
endfunc
func! Foo(...) abort
    echo call('Bar', a:000)
endfunc

call Foo('asdf', 'qwer') " --> ['asdf', 'qwer']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.