lua-users home
lua-l archive

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


Am 07.04.2014 20:06 schröbte Petite Abeille:

On Apr 7, 2014, at 12:10 PM, Tony Papadimitriou <tonyp@acm.org> wrote:

However, I think the arg[0] 'trick' does not work with redirection:

What’s ‘redirection’ in this context?

    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.


(Keep in mind that a Lua chunk doesn’t have to be file based, e.g. heredoc or dynamically generated code or whatever is not file based…)


Philipp