mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 12:08:21 +01:00
remove uses of arg in the codebase
This commit is contained in:
parent
eea1bc04d7
commit
33b4f0cfc7
@ -50,7 +50,7 @@ function socket.protect(f)
|
|||||||
return function(...)
|
return function(...)
|
||||||
local co = coroutine.create(f)
|
local co = coroutine.create(f)
|
||||||
while true do
|
while true do
|
||||||
local results = {coroutine.resume(co, base.unpack(arg))}
|
local results = {coroutine.resume(co, ...)}
|
||||||
local status = table.remove(results, 1)
|
local status = table.remove(results, 1)
|
||||||
if not status then
|
if not status then
|
||||||
if base.type(results[1]) == 'table' then
|
if base.type(results[1]) == 'table' then
|
||||||
@ -104,8 +104,7 @@ local function cowrap(dispatcher, tcp, error)
|
|||||||
-- don't override explicitly.
|
-- don't override explicitly.
|
||||||
local metat = { __index = function(table, key)
|
local metat = { __index = function(table, key)
|
||||||
table[key] = function(...)
|
table[key] = function(...)
|
||||||
arg[1] = tcp
|
return tcp[key](tcp,select(2,...))
|
||||||
return tcp[key](base.unpack(arg))
|
|
||||||
end
|
end
|
||||||
return table[key]
|
return table[key]
|
||||||
end}
|
end}
|
||||||
|
@ -4,24 +4,24 @@ local socket = require"socket.unix"
|
|||||||
host = "luasocket"
|
host = "luasocket"
|
||||||
|
|
||||||
function pass(...)
|
function pass(...)
|
||||||
local s = string.format(unpack(arg))
|
local s = string.format(...)
|
||||||
io.stderr:write(s, "\n")
|
io.stderr:write(s, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function fail(...)
|
function fail(...)
|
||||||
local s = string.format(unpack(arg))
|
local s = string.format(...)
|
||||||
io.stderr:write("ERROR: ", s, "!\n")
|
io.stderr:write("ERROR: ", s, "!\n")
|
||||||
socket.sleep(3)
|
socket.sleep(3)
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function warn(...)
|
function warn(...)
|
||||||
local s = string.format(unpack(arg))
|
local s = string.format(...)
|
||||||
io.stderr:write("WARNING: ", s, "\n")
|
io.stderr:write("WARNING: ", s, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function remote(...)
|
function remote(...)
|
||||||
local s = string.format(unpack(arg))
|
local s = string.format(...)
|
||||||
s = string.gsub(s, "\n", ";")
|
s = string.gsub(s, "\n", ";")
|
||||||
s = string.gsub(s, "%s+", " ")
|
s = string.gsub(s, "%s+", " ")
|
||||||
s = string.gsub(s, "^%s*", "")
|
s = string.gsub(s, "^%s*", "")
|
||||||
|
Loading…
Reference in New Issue
Block a user