6 ms·
I always wrote Lua off, scoffing at the 1-based indexing, until I was "forced" to learn it thanks to Neovim. What a delightful little language it is. I do wish
by jrop 11mo ago
I always wrote Lua off, scoffing at the 1-based indexing, until I was "forced" to learn it thanks to Neovim. What a delightful little language it is. I do wish I could do certain things less verbosely (lambdas would be nice) -- but then again, I defeat myself by suggesting it, because not having all the features makes Lua so approachable.
- azemetre 11mo agoSame here, in fact something I wish the neovim team would do is create a book where popular plugin authors create tutorials that recreate basic functionality of their plugins. Seems like a no brainer that would help bring in more revenue too, it'd also be an "evergreen" book as new others can contribute over time. I can't be the only one that would immediately buy a copy. :D
- jrop 11mo agoI'm actually trying to work on a video-series to do just this. I've made my own rudimentary plugins reproducing several popular ones, and would like to walk through how I made: a) file-tree b) picker/fzf replacment c) hop/leap replacement d) surround plugin e) code-formatter f) hydra (sub-modes) g) many "UI" (interactive) buffers, etc. None of these are published because the popular ones are better and provide more functionality, but I want to share what I believe is more valuable: what I learned while writing them.
- azemetre 11mo agoThat sounds great! Do you have a youtube channel or something to follow when you release it?
- jrop 11mo agoYep, though I'm still trying to hit my stride recording videos. I don't release regularly because of lots of amazing $life things. https://www.youtube.com/@nocturing https://www.youtube.com/@nocturing If you want a sneak peak of what I want to walk through, check this repo (see the examples/ folder): https://github.com/jrop/u.nvim https://github.com/jrop/u.nvim
- ardit33 11mo agoI used Lua professionally. I prefer the 1 indexing... it just feels more natural. For some reason the C apologists here will scream how 0 based is the only way to go. (which is not, it is just a historical artifact). Languages like ADA allowed you to use either 0 or 1, (or any arbitrary) starting index.
- groovy2shoes 11mo agoLua has lambdas. They too suffer from verbosity, of course, but they're there. function(x) return x; end
- jrop 11mo agoThat's what I meant and didn't communicate well. I'm wishing for short-form syntax of lambdas, to be clear.
- strenholme 11mo agoThere are patches for this so the above can be expressed with something like this: [ (x) | x ] http://lua-users.org/files/wiki_insecure/power_patches/5.4/lua-5.4.2_shorthand-lambdas.patch http://lua-users.org/files/wiki_insecure/power_patches/5.4/l... And for Lua 5.1: http://lua-users.org/files/wiki_insecure/power_patches/5.1/lua-5.1.4_shorthand-lambdas.patch http://lua-users.org/files/wiki_insecure/power_patches/5.1/l... (I personally don’t use patches like this because “Lua 5.1” is something pretty standardized with a bunch of different implementations; e.g. I wrote my Lua book with a C# developer who was using the moonsharp Lua implementation)