lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8 September 2016 at 01:44, Aapo Talvensaari
<aapo.talvensaari@gmail.com> wrote:
> On 7 September 2016 at 17:53, Daurnimator <quae@daurnimator.com> wrote:
>>
>> On 8 September 2016 at 00:40, Dirk Laurie <dirk.laurie@gmail.com> 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**