by vrighter · 1y ago · 0 comments
The first sentence in its readme is the following: "Astra is a web server runtime for Lua (5.1-5.4), Luau and LuaJIT written in Rust with native support for Teal."
Would you say the Lua interpreter is also a Lua runtime?
Don’t most people simply use the LuaFileSystem library for that? https://github.com/lunarmodules/luafilesystem
I think you (and the project) are using “runtime” when what you really mean environment.
That rudimentary "built-in" io that's included with lua? It's actually a library shipped with the interpreter, that you need to explicitly load in from the C side of things.
Exiting with a process exit code? Optional library.
String operations such as pattern matching? Optional library.
Math? Optional library.
Debugging? Optional library.
If you didn't load any of these, then the only I/O you could do is to stdout with the print statement. When you instantiate a new lua state, you are expected to provide your own runtime. It's a language designed to be embedded in other software.
Take, for example, libc. It's the C runtime. It doesn't compile or interpret C. libc is just a bunch of C code (with assembly sprinkled in, of course).