[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [SUGGESTION] Some lfs functionality in os library, please!
- From: Daurnimator <quae@...>
- Date: Thu, 8 Sep 2016 02:01:25 +1000
On 8 September 2016 at 01:44, Aapo Talvensaari
> On 7 September 2016 at 17:53, Daurnimator <email@example.com> wrote:
>> On 8 September 2016 at 00:40, Dirk Laurie <firstname.lastname@example.org> wrote:
>> > Every time I require lfs, I ask myself: why is this stuff not in the
>> > os library?
>> Everytime I see the `os` library I ask: why did this come with lua? I
>> always replace it with my own variants anyway.
> Any examples? Lua only or Lua + C module?
Instead of os.date or os.time I use luatz https://github.com/daurnimator/luatz
- usually I want time more accurate than to the second (this is an
optional part of luatz, and is the only bit that requires C code)
- timezones are important!
(Infact, usually when someone reaches for `os.time()` they actually
wanted a monotonic clock)
Instead of os.execute I use lua-spawn https://github.com/daurnimator/lua-spawn
os.rename doesn't work across file systems
- usually just shell out (with lua-spawn) to `mv`
os.getenv isn't powerful enough:
Almost everytime I need it I either need to enumerate all env vars, or
follow it up with a setenv
For setenv, lately I've been using lunix: https://github.com/wahern/lunix
Before that, lposix
Before that, lua-ex http://lua-users.org/wiki/ExtensionProposal
Remembering that prompts me: aren't the functions dirk proposes almost
exactly the lua-ex api?
**feelings of deja vu**