How to solve treesitter/highlighter: Error executing lua problem in neovim config
I had a similar issue. I ran :TSUpdate in Neovim to update Treesitter plugin and the error message disapear after relaunching.
I had a similar issue. I ran :TSUpdate in Neovim to update Treesitter plugin and the error message disapear after relaunching.
There is no standard Lua package management system, but you can try out the following: LuaRocks – contains a rather large number of Lua modules distributed as rocks. Once LuaRocks is installed, the installation is simple: luarocks install desired-package. On Linux/Unix/Mac, this will install into /usr/local/{share,lib}/lua/5.1, where the Lua interpreter looks for modules. LuaDist – … Read more
Use #: > a = {10, 11, 12, 13} > print(#a) 4 Notice however that the length operator # does not work with tables that are not arrays, it only counts the number of elements in the array part (with indices 1, 2, 3 etc.). This won’t work: > a = {1, 2, [5] = … Read more
It works, you just have to assign the actual result/return value. Use one of the following variations: str = str:gsub(“%s+”, “”) str = string.gsub(str, “%s+”, “”) I use %s+ as there’s no point in replacing an empty match (i.e. there’s no space). This just doesn’t make any sense, so I look for at least one … Read more
There is no quit keyword. Try control-D in Unix, control-Z in Windows or os.exit() if you must.
[I was going to post this as a comment on John Cromartie’s post, but didn’t realize you couldn’t use formatting in a comment.] I agree. Dropping it to a shell with os.execute() will definitely work but in general making shell calls is expensive. Wrapping some C code will be much quicker at run-time. In C/C++ … Read more
I hate having to install libraries (especially those that want me to use installer packages to install them). If you’re looking for a clean solution for a directory listing on an absolute path in Lua, look no further. Building on the answer that sylvanaar provided, I created a function that returns an array of all … Read more
From Lua using debug.getinfo, e.g., local line = debug.getinfo(1).currentline From C using lua_getinfo (This will return the linenumber inside lua code) lua_Debug ar; lua_getstack(L, 1, &ar); lua_getinfo(L, “nSl”, &ar); int line = ar.currentline http://www.lua.org/manual/5.1/manual.html#lua_getinfo http://www.lua.org/manual/5.1/manual.html#pdf-debug.getinfo
Lua doesn’t have strict arrays like other languages – it only has hash tables. Tables in Lua are considered array-like when their indices are numerical and densely packed, leaving no gaps. The indices in the following table would be 1, 2, 3, 4. local t = {‘a’, ‘b’, ‘c’, ‘d’} When you have an array-like … Read more
Try this str=”cat,dog” for word in string.gmatch(str, ‘([^,]+)’) do print(word) end ‘[^,]’ means “everything but the comma, the + sign means “one or more characters”. The parenthesis create a capture (not really needed in this case).