[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require local file
- From: "Dimiter \"malkia\" Stanev" <malkia@...>
- Date: Mon, 21 Nov 2011 21:31:38 -0800
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:
But under emacs + lua-mode, I get:
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
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.