EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

🌸 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 to true and an EPERM will ✨not✨ be reported. instead, you just get an iterator over an empty collection. that's it, that's the whole mood. defaults to false, so by default EPERM does get reported β€” so flip it if you'd rather get nothing back than deal with the error πŸ™ˆ

lowkey important: that EPERM thing is the entire reason this option exists. true = no error, empty iterator. false (the default) = the EPERM is 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