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

github.com/torch/xlua.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2011-07-06 01:33:48 +0400
committerClement Farabet <clement.farabet@gmail.com>2011-07-06 01:33:48 +0400
commit6a1da6f84dd31cdf0e7443e6e0fc114be280c874 (patch)
treea800741d244e314562e1190e6f0ba9408a58230e
parent6435da0e5d1410b890e7dee4d04e09231a221570 (diff)
Fixed screwed require
-rw-r--r--xlua.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/xlua.lua b/xlua.lua
index 5471487..d743aee 100644
--- a/xlua.lua
+++ b/xlua.lua
@@ -265,7 +265,8 @@ end
-- @param server specify a luarocks server
--------------------------------------------------------------------------------
function require(package,luarocks,server)
- local load = function() glob.require(package) end
+ local loaded
+ local load = function() loaded = glob.require(package) end
local ok,err = glob.pcall(load)
if not ok then
if luarocks then
@@ -289,7 +290,7 @@ function require(package,luarocks,server)
if package == 'torch' then
print('package <torch> installed, please restart Lua!')
else
- glob.require(package)
+ loaded = glob.require(package)
print('package installed and loaded!')
end
else
@@ -305,6 +306,7 @@ function require(package,luarocks,server)
end
return false
end
+ return loaded
end
glob.xrequire = require