[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require() relative to calling file
- From: Scott Morgan <blumf@...>
- Date: Fri, 3 Feb 2017 09:16:30 +0000
On 02/03/2017 07:34 AM, Russell Haley wrote:
> But the question was what is the argument against the approach
> described. It always has seemed to me that Lua goes to great length
> to search relative paths and entirely negates to look in the
> application path for no reason whatsoever. It was one of the most
> confusing things when I first started looking at Lua.
Lua does use the EXE path in Windows, but under *nix systems things
aren't so simple. There's no guarantee that the path to the executable
exists and no clear way to determine it even if it does (some hacky,
platform dependant ways, but nothing clean).
See luaconf.h (search WIN32) and loadlib.c (search for windows.h)
Personally, I go with a shell script wrapper that sets the LUA_PATH etc.
environment vars before launching the app/Lua interpreter
 On the plus side, this is partly why you can apply updates on *nix
systems without having to reboot all the time. Windows locks it's
EXE/DLL files when used, so you can't overwrite them unless the app
stops, *nix systems don't.