diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-07-18 13:42:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-18 13:42:07 +0200 |
commit | 44b4f8c6e9645da133a9f222640d3a2b0f3e45f7 (patch) | |
tree | 3e55cbeaac59b359e21c79e38c1e5c900dfb7af4 /runtime/doc/if_lua.txt | |
parent | cd6e7e8cf302f7d2397c89a65a483f9cd543f9dd (diff) | |
parent | 061545068816ac346addf0fecdc2f554983251f4 (diff) | |
download | rneovim-44b4f8c6e9645da133a9f222640d3a2b0f3e45f7.tar.gz rneovim-44b4f8c6e9645da133a9f222640d3a2b0f3e45f7.tar.bz2 rneovim-44b4f8c6e9645da133a9f222640d3a2b0f3e45f7.zip |
Merge #8679 from justinmk/doc
Diffstat (limited to 'runtime/doc/if_lua.txt')
-rw-r--r-- | runtime/doc/if_lua.txt | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 968d882a22..17c1a8a329 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -310,14 +310,22 @@ semantically equivalent in Lua to: return chunk(arg) -- return typval end -Note that "_A" receives the argument to "luaeval". Lua nils, numbers, strings, -tables and booleans are converted to their respective VimL types. An error is -thrown if conversion of any of the remaining Lua types is attempted. - -Note 2: lua tables are used as both dictionaries and lists, thus making it -impossible to determine whether empty table is meant to be empty list or empty -dictionary. Additionally lua does not have integer numbers. To distinguish -between these cases there is the following agreement: +Lua nils, numbers, strings, tables and booleans are converted to their +respective VimL types. An error is thrown if conversion of any other Lua types +is attempted. + +The magic global "_A" contains the second argument to luaeval(). + +Example: > + :echo luaeval('_A[1] + _A[2]', [40, 2]) + 42 + :echo luaeval('string.match(_A, "[a-z]+")', 'XYXfoo123') + foo + +Lua tables are used as both dictionaries and lists, so it is impossible to +determine whether empty table is meant to be empty list or empty dictionary. +Additionally lua does not have integer numbers. To distinguish between these +cases there is the following agreement: 0. Empty table is empty list. 1. Table with N incrementally growing integral numbers, starting from 1 and |