[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require local file
- From: "Dimiter \"malkia\" Stanev" <malkia@...>
- Date: Mon, 21 Nov 2011 21:31:38 -0800
Thanks Daurnimator,
To get the directory of the current script; I use:
local rel_dir = assert ( debug.getinfo ( 1 , "S" ).source:match (
[=[^@(.-[/\]?)[^/\]*$]=] ) , "Current directory unknown" ) .. "./"
This returns in the terminal:
tests/zmq/./
But under emacs + lua-mode, I get:
/var/folders/cc/583r_nn111b8_29d4t72kdlm0000gn/T/./
Then in your module, add to package.(c)path:
package.path = rel_dir .. "?.lua;" .. package.path
Actually I'll be fine in just doing, if the one up succeeds.
require( rel_path .. "the module" )
Maybe I should work on trying to fix this in the emacs lua-mode if
possible.
Also I don't want to modify package.path, etc. My goal is to be able to
use this on a plugin level (Autodesk products), and I don't want to
interfere with other modules.
E.g. I don't want loading of one module to change the behaviour of another.