Learn Lua in Neovim: First-Class Functions — Store, Pass & Filter with Functions | Episode 15
8views
009:56
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Functions are data too. In this episode we store a function in a variable, pass functions as arguments
(callbacks), write anonymous inline functions, and build a filter that selects items from a list.
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:
- local square = function(x) — storing a function in a variable
- Callbacks — passing functions as arguments to other functions
- apply(math.sqrt, 25) — any function can be passed as a value
- Anonymous functions — inline functions with no name
- filter(items, test) — a higher-order function that selects matching items
- First-class functions — the foundation for closures and functional patterns
Timestamps:
0:00 Intro
0:12 Preview
0:44 Function in a Variable — local square = function(x)
1:56 Run: 5 squared is 25
2:24 Callbacks — function apply(func, value)
3:58 Run: sqrt and square callbacks
4:32 Filter with Anonymous Function
7:58 Run: Even numbers filtered
8:14 Code review
8:24 Recap
Key Takeaways:
1. Functions are values — store them in variables like any other data
2. Callbacks let callers customize behavior by passing a function
3. Anonymous functions are defined inline without a name
4. filter() shows the power of first-class functions
This is Episode 15 of the Learn Lua in Neovim series. New episodes cover closures, tables, metatables, and
more — all coded inside Neovim.
Taught by CelesteAI. Like & subscribe for more tutorials!
#lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #luafunctions
#firstclassfunctions #callbacks #anonymousfunctions #coding
Tags
lua, lua tutorial, learn lua, lua functions as values, lua first-class functions, lua callbacks, lua anonymous
functions, lua filter, lua higher-order functions, lua function variable, lua for beginners, neovim lua,
neovim tutorial, learn lua in neovim, lua episode 15, programming tutorial, coding tutorial, beginner
programming, lua 2026, neovim 2026, screenkey, code along, lua basics
Tags
lualua tutoriallearn lualua functions as valueslua first-class functionslua callbackslua anonymous functionslua filterlua higher-order functionslua function variablelua for beginnersneovim luaneovim tutoriallearn lua in neovimlua episode 15