Loading ...
Sorry, an error occurred while loading the content.

Error when calling a user defined function.

Expand Messages
  • yixiaodafang@gmail.com
    Hi, I have defined a function such as: function! g:test(pattern, action) let l:tmp=a:pattern endfunction When I call it using: debug call g:test(llan,vvm)
    Message 1 of 2 , Apr 29, 2010
    • 0 Attachment
      Hi,

      I have defined a function such as:

      function! g:test(pattern, action)
      let l:tmp=a:pattern
      endfunction

      When I call it using:

      debug call g:test(llan,vvm)

      After I type s for single step, I got

      E121: Undefined variable: llan
      E116: Invalid arguments for function g:test

      I have other similar functions and they are running find. Only this
      one give me such error message. If I quote the input as:

      debug call g:test("llan","wm")

      then I do not have problme. Can someone help me to see why this is
      happening?

      Thanks

      Frank

      --
      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
    • John Beckett
      ... In something like call test(hello) the hello is an expression that is evaluated, so hello would have to be a ... John -- You received this message
      Message 2 of 2 , Apr 29, 2010
      • 0 Attachment
        yixiaodafang wrote:
        > When I call it using:
        >
        > debug call g:test(llan,vvm)
        >
        > After I type s for single step, I got
        >
        > E121: Undefined variable: llan
        > E116: Invalid arguments for function g:test

        In something like 'call test(hello)' the 'hello' is an
        expression that is evaluated, so 'hello' would have to be a
        defined variable; you could display the value with:

        :echo hello

        John

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.