diff options
author | mpeterv <petjamelnik@yandex.ru> | 2014-03-21 11:20:27 +0400 |
---|---|---|
committer | mpeterv <petjamelnik@yandex.ru> | 2014-03-21 11:20:27 +0400 |
commit | d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3 (patch) | |
tree | 526fb1b019ae8084bcb595170833c83425854f25 | |
parent | 37e38841ba7445d724787b1b7c8145dbe1136f43 (diff) | |
download | luarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.tar.gz luarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.tar.bz2 luarocks-d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3.zip |
Fixed some issues with table.unpack
-rw-r--r-- | src/luarocks/command_line.lua | 2 | ||||
-rw-r--r-- | src/luarocks/loader.lua | 11 |
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) |
4 | local command_line = {} | 4 | local command_line = {} |
5 | 5 | ||
6 | local unpack = unpack or table.unpack | ||
7 | |||
6 | local util = require("luarocks.util") | 8 | local util = require("luarocks.util") |
7 | local cfg = require("luarocks.cfg") | 9 | local cfg = require("luarocks.cfg") |
8 | local path = require("luarocks.path") | 10 | local 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. |
8 | local global_env = _G | 8 | local loaders = package.loaders or package.searchers |
9 | local package, require, ipairs, pairs, table, type, next, unpack, tostring, error = | 9 | local 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 |
11 | local unpack = unpack or table.unpack | ||
11 | 12 | ||
12 | --module("luarocks.loader") | 13 | --module("luarocks.loader") |
13 | local loader = {} | 14 | local 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. |
111 | local function call_other_loaders(module, name, version, module_name) | 112 | local 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 |
211 | end | 212 | end |
212 | 213 | ||
213 | table.insert(global_env.package.loaders, 1, loader.luarocks_loader) | 214 | table.insert(loaders, 1, loader.luarocks_loader) |
214 | 215 | ||
215 | return loader | 216 | return loader |