lua-users home
lua-l archive

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

I've just had a report that WordGrinder is failing on a system with a
Portugese locale. This turns out to be because it's got localised errno
strings. So, my code, which does this:

    local fp, e ="somefile")
    if e and not e:find("No such file or directory") then

...gets confused, because the actual string in e is "Arquivo ou
diretório não encontrado".

I *could* do something really evil:

    local _, filenotfound ="/this/file/is/guaranteed/missing")
    if e != filenotfound then

...but I can't really guarantee that the path doesn't exist.

What I'd really prefer is an errno (and a set of errno constants). But
Lua doesn't expose those. Any suggestions?

┌─── ───── ─────
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_

Attachment: signature.asc
Description: OpenPGP digital signature