mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
Merge pull request #157 from mpeterv/ltn12-lua53
Fix error in ltn12 under Lua 5.3
This commit is contained in:
commit
280e1d68a6
@ -9,6 +9,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
local string = require("string")
|
local string = require("string")
|
||||||
local table = require("table")
|
local table = require("table")
|
||||||
|
local unpack = unpack or table.unpack
|
||||||
local base = _G
|
local base = _G
|
||||||
local _M = {}
|
local _M = {}
|
||||||
if module then -- heuristic for exporting a global package table
|
if module then -- heuristic for exporting a global package table
|
||||||
@ -42,7 +43,7 @@ end
|
|||||||
-- (thanks to Wim Couwenberg)
|
-- (thanks to Wim Couwenberg)
|
||||||
function filter.chain(...)
|
function filter.chain(...)
|
||||||
local arg = {...}
|
local arg = {...}
|
||||||
local n = select('#',...)
|
local n = base.select('#',...)
|
||||||
local top, index = 1, 1
|
local top, index = 1, 1
|
||||||
local retry = ""
|
local retry = ""
|
||||||
return function(chunk)
|
return function(chunk)
|
||||||
|
@ -61,7 +61,7 @@ function _M.parse_from(from)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function _M.split_mbox(mbox_s)
|
function _M.split_mbox(mbox_s)
|
||||||
mbox = {}
|
local mbox = {}
|
||||||
mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n"
|
mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n"
|
||||||
local nj, i, j = 1, 1, 1
|
local nj, i, j = 1, 1, 1
|
||||||
while 1 do
|
while 1 do
|
||||||
|
@ -74,7 +74,7 @@ function metat.__index:command(cmd, arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function metat.__index:sink(snk, pat)
|
function metat.__index:sink(snk, pat)
|
||||||
local chunk, err = c:receive(pat)
|
local chunk, err = self.c:receive(pat)
|
||||||
return snk(chunk, err)
|
return snk(chunk, err)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -219,6 +219,7 @@ end
|
|||||||
-- corresponding absolute url
|
-- corresponding absolute url
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
function _M.absolute(base_url, relative_url)
|
function _M.absolute(base_url, relative_url)
|
||||||
|
local base_parsed
|
||||||
if base.type(base_url) == "table" then
|
if base.type(base_url) == "table" then
|
||||||
base_parsed = base_url
|
base_parsed = base_url
|
||||||
base_url = _M.build(base_parsed)
|
base_url = _M.build(base_parsed)
|
||||||
|
Loading…
Reference in New Issue
Block a user