[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: require local file
- From: "Dimiter \"malkia\" Stanev" <malkia@...>
- Date: Mon, 21 Nov 2011 21:15:54 -0800
Probably posted here already, and there were couple of discussions, but
I still can't get around writing a simple version for require that works
with local files.
For example, my project tree is like this:
tests/zmq/test_hwm.lua
In this file I'm "requiring" tests/zmq/testutil.lua:
local testutil = require( "tests/zmq/testutil" )
But this seems very fixed to my project. "testutil.lua" is only used by
the "tests/zmq" folder, and if the whole folder is moved, or LUA_PATH
happens to be different, it should still work...
I've looked at "...", arg, and certain debug. facilities, but I can't
find something that works always fine from the command line, and (in my
case) from emacs using (lua-mode).
One thing with emacs's lua-mode is that I can't get the proper lua-file
name, but a temporary name, but I guess there is not an easy workaround.
Anyone with better ideas?
And something that is going to be possible (if not easy) to remember...
a pattern of some kind...