Add ingo#funcref#AsString()

In contrast to ingo#funcref#ToString(), this can be useful when concatenating Funcrefs (and keep them as Funcrefs, i.e. with the function(...)) with other types, avoiding "E729: using Funcref as a String".
This commit is contained in:
Ingo Karkat
2018-03-25 10:25:32 +02:00
parent d560b86d6a
commit 066649053a
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -86,6 +86,7 @@ HISTORY
- Add ingo/workingdir.vim module.
- Add ingo/selection/virtcols.vim module.
- Add ingo/str/list.vim module.
- Add ingo#funcref#AsString().
##### 1.034 13-Feb-2018
- Add ingo/regexp/split.vim module.
+5 -1
View File
@@ -2,7 +2,7 @@
"
" DEPENDENCIES:
"
" Copyright: (C) 2013-2017 Ingo Karkat
" Copyright: (C) 2013-2018 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
@@ -15,4 +15,8 @@ function! ingo#funcref#ToString( Funcref )
return (empty(l:functionName) ? '' . a:Funcref : l:functionName)
endfunction
function! ingo#funcref#AsString( Funcref )
return (type(a:Funcref) == 2 ? string(a:Funcref) : a:Funcref)
endfunction
" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
+1
View File
@@ -100,6 +100,7 @@ HISTORY *ingo-library-history*
- Add ingo/workingdir.vim module.
- Add ingo/selection/virtcols.vim module.
- Add ingo/str/list.vim module.
- Add ingo#funcref#AsString().
1.034 13-Feb-2018
- Add ingo/regexp/split.vim module.