Other Using flua (Lua in base) for scripting

Have you used flua for your own tasks? It's fascinating to me that FreeBSD now ships with a full-fledged Lua interpreter (Lua 5.3 in FreeBSD 13 and Lua 5.4 in FreeBSD 14). This is a big step up in scripting capability compared to traditional shell, awk, and sed.

The Developers' Handbook cautions against third-party software depending on flua. This makes sense for production applications that have uptime requirements. They shouldn't depend on an internal component without a stability guarantee. However, relying on flua for non-critical scripts seems to carry little downside. You can migrate the scripts to Lua in the Ports Collection if flua is replaced or removed. Until then, a range of FreeBSD systems will be able to run your scripts with no ports required.

If you have used flua, please share your experience and share your work.
 
flua hasn't seen much use outside the base system. The one prominent example I know is that pkgbasify is written in it. I have used flua for lsblk.lua and a Lua port of vermaden's sensors(8).

A search of code forges turns up a few other projects that aren't forks of FreeBSD and haven't been merged into FreeBSD:
  • camio: "camio: a tcpdump for cam using lua and dtrace"
  • flua-missions: "Koan exercises for Lua using FreeBSD's flua"
  • flualibs: "Various C modules for FreeBSD's Lua interpreter (flua)"
  • ldconfig: "Work directory for LUA implementation of sbin/ldconfig"
  • lua-httpd: "Demo web applications built with FreeBSD's Lua interpreter (flua)"
This seems pretty much it for open-source projects.
 
you really shouldn't use flua for your own scripts, it's only intended for use by the operating system itself. it might vanish tomorrow with no notice.

i do think we should consider providing a public version of Lua though, since we're shipping it anyway and it's a much better alternative to shell scripts for many tasks, the sort of things people used to write in Perl when that was in the base system.
 
you really shouldn't use flua for your own scripts, it's only intended for use by the operating system itself. it might vanish tomorrow with no notice.
That's a pretty strong take. It's just your opinion or can this be considered the reality of freebsd scripting up to 15.x? Not that I don't believe you, I'm genuinely asking.
 
That's a pretty strong take. It's just your opinion or can this be considered the reality of freebsd scripting up to 15.x? Not that I don't believe you, I'm genuinely asking.
this is specifically about flua, not "FreeBSD scripting" in general. that's why flua is installed in /usr/libexec rather than /usr/bin.

the manual page flua(1) mentions this several times:
flua is intended for internal use within the base system and is not designed for general-purpose scripting or use by third-party applications. [...] flua is typically invoked internally by FreeBSD base system tools and build scripts. While it accepts Lua source files and arguments in a standard fashion, its limited environment and module support make it unsuitable for general scripting use. [...] flua should not be used as a replacement for lua(1) from the Ports Collection (e.g., lang/lua54) as it may be modified or updated to a newer Lua version in the future without retaining backwards compatibility.
at this point it's unlikely that flua will actually be removed, but it could certainly be moved to a new location, or the name could be changed, or any other number of changes could be made that would break third-party scripts that use flua. as the manual page says, it is only intended for use by the base system.
 
Yep, but Forth is still there if you want it.
Even FICL entry was removed from loader(8) in 13.2, and environment variables are moved to loader_simp(8), but also not a word about FICL there.

Yes, I know that there is lang/ficl pkg... Not that I'm a Forth expert, far from it, but I'm sorta nostalgic about it, what I learned of it as a kid on ZX Spectrum was later excellent base for me when I started to learn PostScript.
 
Even FICL entry was removed from loader(8) in 13.2, and environment variables are moved to loader-simp(8), but also not a word about FICL there.

Yes, I know that there is lang/ficl pkg... Not that I'm a Forth expert, far from it, but I'm sorta nostalgic about it, what I learned of it as a kid on ZX Spectrum was later excellent base for me when I started to learn PostScript.
Forth is still there according to the man page. It is just that the FICL in base is very out of date.
 
Back
Top