diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2016-02-11 11:01:57 -0200 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2016-02-11 11:01:57 -0200 |
commit | 280e1d68a62ebf65b4526e300813e6d805216ea7 (patch) | |
tree | 0e4bb188501594fdb274bbe88dc600558ecaed12 | |
parent | 83880dbed77f9a0a3627bce2e7bfbe1b862e091d (diff) | |
parent | 91928813466cd10b1b4e6f118f2decfb3b2aba33 (diff) | |
download | luasocket-280e1d68a62ebf65b4526e300813e6d805216ea7.tar.gz luasocket-280e1d68a62ebf65b4526e300813e6d805216ea7.tar.bz2 luasocket-280e1d68a62ebf65b4526e300813e6d805216ea7.zip |
Merge pull request #157 from mpeterv/ltn12-lua53
Fix error in ltn12 under Lua 5.3
-rw-r--r-- | src/ltn12.lua | 3 | ||||
-rw-r--r-- | src/mbox.lua | 2 | ||||
-rw-r--r-- | src/tp.lua | 2 | ||||
-rw-r--r-- | src/url.lua | 1 |
4 files changed, 5 insertions, 3 deletions
diff --git a/src/ltn12.lua b/src/ltn12.lua index 1014de2..dede0fa 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua | |||
@@ -9,6 +9,7 @@ | |||
9 | ----------------------------------------------------------------------------- | 9 | ----------------------------------------------------------------------------- |
10 | local string = require("string") | 10 | local string = require("string") |
11 | local table = require("table") | 11 | local table = require("table") |
12 | local unpack = unpack or table.unpack | ||
12 | local base = _G | 13 | local base = _G |
13 | local _M = {} | 14 | local _M = {} |
14 | if module then -- heuristic for exporting a global package table | 15 | if module then -- heuristic for exporting a global package table |
@@ -42,7 +43,7 @@ end | |||
42 | -- (thanks to Wim Couwenberg) | 43 | -- (thanks to Wim Couwenberg) |
43 | function filter.chain(...) | 44 | function filter.chain(...) |
44 | local arg = {...} | 45 | local arg = {...} |
45 | local n = select('#',...) | 46 | local n = base.select('#',...) |
46 | local top, index = 1, 1 | 47 | local top, index = 1, 1 |
47 | local retry = "" | 48 | local retry = "" |
48 | return function(chunk) | 49 | return function(chunk) |
diff --git a/src/mbox.lua b/src/mbox.lua index 7724ae2..ed9e781 100644 --- a/src/mbox.lua +++ b/src/mbox.lua | |||
@@ -61,7 +61,7 @@ function _M.parse_from(from) | |||
61 | end | 61 | end |
62 | 62 | ||
63 | function _M.split_mbox(mbox_s) | 63 | function _M.split_mbox(mbox_s) |
64 | mbox = {} | 64 | local mbox = {} |
65 | mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n" | 65 | mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n" |
66 | local nj, i, j = 1, 1, 1 | 66 | local nj, i, j = 1, 1, 1 |
67 | while 1 do | 67 | while 1 do |
@@ -74,7 +74,7 @@ function metat.__index:command(cmd, arg) | |||
74 | end | 74 | end |
75 | 75 | ||
76 | function metat.__index:sink(snk, pat) | 76 | function metat.__index:sink(snk, pat) |
77 | local chunk, err = c:receive(pat) | 77 | local chunk, err = self.c:receive(pat) |
78 | return snk(chunk, err) | 78 | return snk(chunk, err) |
79 | end | 79 | end |
80 | 80 | ||
diff --git a/src/url.lua b/src/url.lua index 7809535..fbd93d1 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -219,6 +219,7 @@ end | |||
219 | -- corresponding absolute url | 219 | -- corresponding absolute url |
220 | ----------------------------------------------------------------------------- | 220 | ----------------------------------------------------------------------------- |
221 | function _M.absolute(base_url, relative_url) | 221 | function _M.absolute(base_url, relative_url) |
222 | local base_parsed | ||
222 | if base.type(base_url) == "table" then | 223 | if base.type(base_url) == "table" then |
223 | base_parsed = base_url | 224 | base_parsed = base_url |
224 | base_url = _M.build(base_parsed) | 225 | base_url = _M.build(base_parsed) |