summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-12 21:49:00 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-12 21:49:00 +0100
commita47e05f04a5a5c0369c949157c24d09cbe64ad6a (patch)
tree7d6a27b717ed6c478f4642fd7af13913a4c07f3b /runtime
parent64ed4d4398e92ac56a9bbd66d5ec992dd4c335f7 (diff)
patch 8.2.2339: cannot get the type of a value as a stringv8.2.2339
Problem: Cannot get the type of a value as a string. Solution: Add typename().
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt11
-rw-r--r--runtime/doc/usr_41.txt3
2 files changed, 12 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index d31ba2d362..76c5548532 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -3016,7 +3016,8 @@ tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
trim({text} [, {mask} [, {dir}]])
String trim characters in {mask} from {text}
trunc({expr}) Float truncate Float {expr}
-type({name}) Number type of variable {name}
+type({expr}) Number type of value {expr}
+typename({expr}) String representation of the type of {expr}
undofile({name}) String undo file name for {name}
undotree() List undo file tree
uniq({list} [, {func} [, {dict}]])
@@ -11129,6 +11130,14 @@ type({expr}) The result is a Number representing the type of {expr}.
< Can also be used as a |method|: >
mylist->type()
+
+typename({expr}) *typename()*
+ Return a string representation of the type of {expr}.
+ Example: >
+ echo typename([1, 2, 3])
+ list<number>
+
+
undofile({name}) *undofile()*
Return the name of the undo file that would be used for a file
with name {name} when writing. This uses the 'undodir'
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 624bb934f5..5f9c8e1bdc 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -720,7 +720,8 @@ Other computation: *bitwise-function*
srand() initialize seed used by rand()
Variables: *var-functions*
- type() type of a variable
+ type() type of a variable as a number
+ typename() type of a variable as text
islocked() check if a variable is locked
funcref() get a Funcref for a function reference
function() get a Funcref for a function name