3 ms·
the lua interpreter by itself is similar in scope to freestanding c. You can do anything, but you have to do everything. Lua doesn't come with much. Just some v
by vrighter 11mo ago
the lua interpreter by itself is similar in scope to freestanding c. You can do anything, but you have to do everything. Lua doesn't come with much. Just some very basic file io (not even including listing files). Stuff that embeds lua is supposed to provide a runtime for lua programs to actually interact with.
- andsoitis 11mo ago> Lua doesn't come with much. Just some very basic file io (not even including listing files) Don’t most people simply use the LuaFileSystem library for that? https://github.com/lunarmodules/luafilesystem https://github.com/lunarmodules/luafilesystem I think you (and the project) are using “runtime” when what you really mean environment.
- vrighter 11mo agoYes most do. But that is not part of lua. That is just a library one can load. It's written in C. The lua interpreter does not allow any access to the outside world. 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).