3 ms·
This "indefensible omission" is solved by using LuaFileSystem. Not having it in the core language is not such a problem. Another example is sleep(), which is no
by catwell 12y ago
This "indefensible omission" is solved by using LuaFileSystem. Not having it in the core language is not such a problem. Another example is sleep(), which is not portable. You can find a sleep function in libraries like LuaSocket and luaposix.
Fragmentation, however, is a problem. The Lua authors have often refused to "bless" (term used by the community when discussing this) libraries. Roberto Ierusalimschy even said during a Q&A he'd rather "bless" a group of people to do it instead of him.
The problem is, as several people said in this thread, that it is very hard to write a library that fits every use case. Even something almost "standard" like LuaSocket is not used by everybody.
Some people in the community (including me) are trying to reduce the fragmentation. The authors of the two main ways to manage "packages" (LuaRocks and LuaDist) are working together, etc. But I think we will never manage to standardize on One True Library for everything.
- ANTSANTS 12y agoI didn't say you couldn't write a trivial library to access sleep or chdir, just that I think it's ridiculous to need to do so. You may disagree, and clearly we can still get work done in the language, but IMHO Lua is suboptimally small, and the local maxima for "tiny yet useful" languages would have a lot more in the standard library and a few "blessed" tools to boot. A language with the goal of implementing in the standard library everything trivial, fungible (one chdir wrapper is as good as any other), useful for most users, and portable across major desktop and mobile OSes (embedded users will know if they don't have e.g. a filesystem) would be a lot more useful yet probably not meaningfully larger than the existing implementations of Lua. Sure, this would mean more stuff to lock down if you're using it as a sandboxed scripting language, but a compile-time flag with reasonable defaults for a sandboxed environment could be provided.
- Houshalter 12y agoThe os.execute function does all this. os.execute("timeout "..seconds) for example. More complicated for file system operations, but it's possible. This is significantly less than optimal though.
- catwell 12y agoAnd not portable (or safe, for things like path manipulation). But sure, you can still use os in small scripts.