EMILUA(3em)
πΈ EMILUA πΈ
okay so you found yourself a page from the Emilua reference manual (that's the 3em manual section, bestie) β and honestly? this one's a little snack. it's like three lines of actual content and it's all about listing a directory π
let's get into it.
β¨ NAME β¨
Emilua β the Lua execution engine. that's the whole vibe. it runs Lua. slay.
β¨ SYNOPSIS β¨
local fs = require "filesystem"
fs.directory_iterator(p: fs.path[, opts: table]) -> function
so you pull in filesystem (yes, via require, classic), and then fs.directory_iterator takes a path p (typed fs.path, no casual strings here) plus an optional opts table, and it hands you back a function. not the entries. a function. keep reading π
β¨ DESCRIPTION β¨
okay so what you actually get back is an iterator function π and here's the thing β every single time you call that bad boy, it returns a filesystem.directory_entry object for one element of the directory p. one call, one entry. call it again, next entry. it's giving main character energy of a for loop's best friend, fr fr π
like, you don't get the whole directory dumped on you at once β you get a little function that feeds you entries one at a time as you ask for them. iconic behaviour tbh π¦
π opts
the optional opts table β here's what's inside:
skip_permission_denied: boolean = false β set this totrueand anEPERMwill β¨notβ¨ be reported. instead, you just get an iterator over an empty collection. that's it, that's the whole mood. defaults tofalse, so by defaultEPERMdoes get reported β so flip it if you'd rather get nothing back than deal with the error π
lowkey important: thatEPERMthing is the entire reason this option exists.true= no error, empty iterator.false(the default) = theEPERMis reported. no cap, that's the deal π
and that's the whole page, bestie β short, sweet, and extremely functional π§ββοΈπ
this little gem comes from Emilua version 0.12.1-nixpkgs1, dated 1980-01-01 β yes, that date is real, it's a whole aesthetic π stay slay, go iterate some directories π
β¨
π¦ where this page comes from
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms