aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpeterv <petjamelnik@yandex.ru>2014-03-21 11:20:27 +0400
committermpeterv <petjamelnik@yandex.ru>2014-03-21 11:20:27 +0400
commitd9c799153ebf5645cf7d7a8fe473c5aff32ec4d3 (patch)
tree526fb1b019ae8084bcb595170833c83425854f25
parent37e38841ba7445d724787b1b7c8145dbe1136f43 (diff)
downloadluarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.tar.gz
luarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.tar.bz2
luarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.zip
Fixed some issues with table.unpack
-rw-r--r--src/luarocks/command_line.lua2
-rw-r--r--src/luarocks/loader.lua11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index 54d64787..3cde4c41 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -3,6 +3,8 @@
3--module("luarocks.command_line", package.seeall) 3--module("luarocks.command_line", package.seeall)
4local command_line = {} 4local command_line = {}
5 5
6local unpack = unpack or table.unpack
7
6local util = require("luarocks.util") 8local util = require("luarocks.util")
7local cfg = require("luarocks.cfg") 9local cfg = require("luarocks.cfg")
8local path = require("luarocks.path") 10local path = require("luarocks.path")
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua
index 1fa15c5e..3d36723f 100644
--- a/src/luarocks/loader.lua
+++ b/src/luarocks/loader.lua
@@ -5,9 +5,10 @@
5-- table in the environment, which records which versions of packages were 5-- table in the environment, which records which versions of packages were
6-- used to load previous modules, so that the loader chooses versions 6-- used to load previous modules, so that the loader chooses versions
7-- that are declared to be compatible with the ones loaded earlier. 7-- that are declared to be compatible with the ones loaded earlier.
8local global_env = _G 8local loaders = package.loaders or package.searchers
9local package, require, ipairs, pairs, table, type, next, unpack, tostring, error = 9local package, require, ipairs, pairs, table, type, next, tostring, error =
10 package, require, ipairs, pairs, table, type, next, unpack, tostring, error 10 package, require, ipairs, pairs, table, type, next, tostring, error
11local unpack = unpack or table.unpack
11 12
12--module("luarocks.loader") 13--module("luarocks.loader")
13local loader = {} 14local loader = {}
@@ -109,7 +110,7 @@ end
109-- @return table or (nil, string): The module table as returned by some other loader, 110-- @return table or (nil, string): The module table as returned by some other loader,
110-- or nil followed by an error message if no other loader managed to load the module. 111-- or nil followed by an error message if no other loader managed to load the module.
111local function call_other_loaders(module, name, version, module_name) 112local function call_other_loaders(module, name, version, module_name)
112 for i, a_loader in ipairs(package.loaders) do 113 for i, a_loader in ipairs(loaders) do
113 if a_loader ~= loader.luarocks_loader then 114 if a_loader ~= loader.luarocks_loader then
114 local results = { a_loader(module_name) } 115 local results = { a_loader(module_name) }
115 if type(results[1]) == "function" then 116 if type(results[1]) == "function" then
@@ -210,6 +211,6 @@ function loader.luarocks_loader(module)
210 end 211 end
211end 212end
212 213
213table.insert(global_env.package.loaders, 1, loader.luarocks_loader) 214table.insert(loaders, 1, loader.luarocks_loader)
214 215
215return loader 216return loader