lua-users home
lua-l archive

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


Am 07.04.2014 21:02 schröbte Petite Abeille:

On Apr 7, 2014, at 8:51 PM, Philipp Janda <siffiejoe@gmx.net> wrote:

    lua < file.lua

'lua - < file.lua’ I guess, but yes, there is no file in that case.

What's wrong with `lua < file.lua`?



More importantly, IMHO, this trick also fails if sym- or hard links to the Lua script are involved ...
And this is probably why a `require_here` will always be a hack: There is no unique file location. There is data and zero or more file paths that refer to that data.

Perhaps. And yet, it’s a useful, practical mechanism when one does indeed deal with regular files. Let not make perfection the enemy of the good.

Well, if I have to deal with an application directory (scripts, modules, and support files bundled together in a directory -- which is *the* use case for `require_here`), I almost always use a symlink to put the scripts into my `$PATH`, so ... not good enough for me[*]. Btw., there is a Linux distribution out there[1] that uses application directories and does the symlinking for every executable ...

Philipp

[*]: the issue with symlinks is solvable if you can use POSIX functions (`readlink`) ...
  [1]: http://nixos.org/nix/manual/#fig-user-environments