Learn Lua in Neovim: Table Array Operations — Sort, Concat & Custom Comparators | Episode 18
4views
0010:17
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Now that you can build arrays, it's time to organize them. In this episode we cover table.sort for ordering elements,
table.concat for joining into strings, custom sort comparators for flexible ordering, and inserting and removing at specific
positions — all coded live in Neovim.
Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace.
Source code:
https://github.com/GoCelesteAI/learn-lua-in-neovim
What You'll Learn:
- table.sort(t) — sort an array in place (ascending)
- table.concat(t, sep) — join array elements into a string
- Custom comparators — table.sort(t, function(a, b) return a gt b end)
- table.insert(t, pos, value) — insert at a specific index
- table.remove(t, pos) — remove from a specific index
- Neovim editing: yy (yank line), p (paste), ci" (change inside quotes), V (visual line select)
Timestamps:
0:00 Intro
0:12 Preview — What You'll Learn
0:44 Coding — Sort and Concat
3:01 First Run — Sorted Names
3:24 Custom Sort Comparator
5:20 Second Run — Ascending & Descending
5:34 Mini To-Do List
8:16 Final Run — Insert, Remove, Print
8:36 Code Review
9:01 Recap
9:33 Next Episode
Key Takeaways:
1. table.sort modifies the array in place
2. table.concat joins array elements with a separator
3. Custom comparators reverse or customize sort order
4. table.insert and table.remove accept position arguments
This is Episode 18 of the Learn Lua in Neovim series. New episodes cover dictionaries, iteration, nested tables, and more — all
coded inside Neovim.
Taught by CelesteAI. Like & subscribe for more tutorials!
#lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #luatablesort #luatableconcat #coding
Tags:
lua, lua tutorial, learn lua, lua table sort, lua table concat, lua table operations, lua sort comparator, lua custom sort, lua
table.insert, lua table.remove, lua array operations, lua join strings, lua for beginners, neovim lua, neovim tutorial, learn
lua in neovim, lua episode 18, programming tutorial, coding tutorial, beginner programming, lua 2026, neovim 2026, screenkey,
code along, lua basics, lua data structures
Tags
lualua tutoriallearn lualua table sortlua table concatlua table operationslua sort comparatorlua custom sortlua table.insertlua table.removelua array operationslua join stringslua for beginnersneovim luaneovim tutorial