Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/env.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoray kavukcuoglu <koray@kavukcuoglu.org>2014-01-27 19:59:38 +0400
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2014-01-27 19:59:38 +0400
commit459ec7c8ec749fd1b744aac7a3a643a34389d370 (patch)
treefe4eac72bbd504969cbfbd6574066d9984f69d02
parent7e740b25db95239c4f23458c96c0c69464b122b2 (diff)
parent5a5245cbbbffb984ca770253c5c76081032655a0 (diff)
Merge pull request #1 from akfidjeland/topic-require-order
Local luarocks paths set up before base packages required
-rw-r--r--init.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/init.lua b/init.lua
index 4256e13..419e291 100644
--- a/init.lua
+++ b/init.lua
@@ -1,3 +1,4 @@
+require 'paths'
-- welcome message
print 'Torch 7.0 Copyright (C) 2001-2011 Idiap, NEC Labs, NYU'
@@ -270,11 +271,20 @@ function import(package, forced)
end
+-- setup local paths (for LuaRocks and Torch-pkg)
+local localinstalldir = paths.concat(paths.home,'.luarocks')
+if paths.dirp(localinstalldir) then
+ package.path = paths.concat(localinstalldir,'share','lua','5.1','?','init.lua') .. ';' .. package.path
+ package.path = paths.concat(localinstalldir,'share','lua','5.1','?.lua') .. ';' .. package.path
+ package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.so') .. ';' .. package.cpath
+ package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.dylib') .. ';' .. package.cpath
+end
+
+
function loaddefaultlibs(loadwithimport)
if loadwithimport == nil then loadwithimport = false end
if not loadwithimport then
-- preload basic libraries
- require 'paths'
require 'torch'
require 'gnuplot'
require 'dok'
@@ -293,13 +303,3 @@ for k,v in pairs(_G) do
_G._preloaded_[k] = true
end
-
--- setup local paths (for LuarRocks and Torch-pkg)
-local localinstalldir = paths.concat(paths.home,'.luarocks')
-if paths.dirp(localinstalldir) then
- package.path = paths.concat(localinstalldir,'share','lua','5.1','?','init.lua') .. ';' .. package.path
- package.path = paths.concat(localinstalldir,'share','lua','5.1','?.lua') .. ';' .. package.path
- package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.so') .. ';' .. package.cpath
- package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.dylib') .. ';' .. package.cpath
-end
-