I am trying to understand how to invoke a callback in Vim9 script.
I have started from this example (from the excellent lacygoill's wiki):

    vim9script

    def Callback(_j: job, _e: number)
        echom 'callback'
    enddef

    def Func()
        job_start(['/bin/bash', '-c', ':'], {exit_cb: Callback})
    enddef

    Func()

That's fine, but now suppose that I want to pass additional arguments to
Callback(). What is Vim9's equivalent of the following?

    fun Callback(value, _j, _e)
      echom 'callback with value: ' .. a:value
    endf

    fun Func()
      call job_start(['/bin/bash', '-c', ':'],
            \ {'exit_cb': function('Callback', [42])})
    endf

    call Func()

Thanks,
Life.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/s90kig%241788%241%40ciao.gmane.io.

Reply via email to