mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 20:38:22 +01:00
Little bug in manual.
This commit is contained in:
parent
3700bf65b7
commit
bdc3e241bb
@ -122,7 +122,7 @@ smtp.<b>send{</b><br>
|
|||||||
[user = <i>string</i>,]<br>
|
[user = <i>string</i>,]<br>
|
||||||
[password = <i>string</i>,]<br>
|
[password = <i>string</i>,]<br>
|
||||||
[server = <i>string</i>,]<br>
|
[server = <i>string</i>,]<br>
|
||||||
[port = <i>string</i>,]<br>
|
[port = <i>number</i>,]<br>
|
||||||
[domain = <i>string</i>,]<br>
|
[domain = <i>string</i>,]<br>
|
||||||
[step = <i>LTN12 pump step</i>,]<br>
|
[step = <i>LTN12 pump step</i>,]<br>
|
||||||
<b>}</b>
|
<b>}</b>
|
||||||
|
@ -31,6 +31,7 @@ function filter.cycle(low, ctx, extra)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
local function chain2(f1, f2)
|
local function chain2(f1, f2)
|
||||||
local ff1, ff2 = "", ""
|
local ff1, ff2 = "", ""
|
||||||
return function(chunk)
|
return function(chunk)
|
||||||
@ -55,6 +56,29 @@ local function chain2(f1, f2)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
|
local function chain2(f1, f2)
|
||||||
|
local co = coroutine.create(function(chunk)
|
||||||
|
while true do
|
||||||
|
local filtered1 = f1(chunk)
|
||||||
|
local filtered2 = f2(filtered1)
|
||||||
|
local done2 = filtered1 and ""
|
||||||
|
while true do
|
||||||
|
if filtered2 == "" or filtered2 == nil then break end
|
||||||
|
coroutine.yield(filtered2)
|
||||||
|
filtered2 = f2(done2)
|
||||||
|
end
|
||||||
|
if filtered1 == "" then chunk = coroutine.yield(filtered1)
|
||||||
|
elseif filtered1 == nil then return nil
|
||||||
|
else chunk = chunk and "" end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return function(chunk)
|
||||||
|
local _, res = coroutine.resume(co, chunk)
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- chains a bunch of filters together
|
-- chains a bunch of filters together
|
||||||
function filter.chain(...)
|
function filter.chain(...)
|
||||||
|
@ -187,7 +187,7 @@ local function cleanup_qptest()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- create test file
|
-- create test file
|
||||||
function create_b64test()
|
local function create_b64test()
|
||||||
local f = assert(io.open(b64test, "wb"))
|
local f = assert(io.open(b64test, "wb"))
|
||||||
local t = {}
|
local t = {}
|
||||||
for j = 1, 100 do
|
for j = 1, 100 do
|
||||||
@ -282,8 +282,8 @@ end
|
|||||||
|
|
||||||
local t = socket.gettime()
|
local t = socket.gettime()
|
||||||
|
|
||||||
identity_test()
|
|
||||||
create_b64test()
|
create_b64test()
|
||||||
|
identity_test()
|
||||||
encode_b64test()
|
encode_b64test()
|
||||||
decode_b64test()
|
decode_b64test()
|
||||||
compare_b64test()
|
compare_b64test()
|
||||||
|
Loading…
Reference in New Issue
Block a user