Merge pull request #157 from mpeterv/ltn12-lua53

Fix error in ltn12 under Lua 5.3
This commit is contained in:
Diego Nehab 2016-02-11 11:01:57 -02:00
commit 280e1d68a6
4 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,7 @@
-----------------------------------------------------------------------------
local string = require("string")
local table = require("table")
local unpack = unpack or table.unpack
local base = _G
local _M = {}
if module then -- heuristic for exporting a global package table
@ -42,7 +43,7 @@ end
-- (thanks to Wim Couwenberg)
function filter.chain(...)
local arg = {...}
local n = select('#',...)
local n = base.select('#',...)
local top, index = 1, 1
local retry = ""
return function(chunk)

View File

@ -61,7 +61,7 @@ function _M.parse_from(from)
end
function _M.split_mbox(mbox_s)
mbox = {}
local mbox = {}
mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n"
local nj, i, j = 1, 1, 1
while 1 do

View File

@ -74,7 +74,7 @@ function metat.__index:command(cmd, arg)
end
function metat.__index:sink(snk, pat)
local chunk, err = c:receive(pat)
local chunk, err = self.c:receive(pat)
return snk(chunk, err)
end

View File

@ -219,6 +219,7 @@ end
-- corresponding absolute url
-----------------------------------------------------------------------------
function _M.absolute(base_url, relative_url)
local base_parsed
if base.type(base_url) == "table" then
base_parsed = base_url
base_url = _M.build(base_parsed)