From 33b4f0cfc7f0a0ebd5d4aaf9bbfe88a02d4368e7 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Wed, 23 Jan 2013 19:13:32 +0100 Subject: [PATCH] remove uses of arg in the codebase --- etc/dispatch.lua | 5 ++--- test/utestclnt.lua | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/etc/dispatch.lua b/etc/dispatch.lua index cc8cb23..f35f358 100644 --- a/etc/dispatch.lua +++ b/etc/dispatch.lua @@ -50,7 +50,7 @@ function socket.protect(f) return function(...) local co = coroutine.create(f) while true do - local results = {coroutine.resume(co, base.unpack(arg))} + local results = {coroutine.resume(co, ...)} local status = table.remove(results, 1) if not status then if base.type(results[1]) == 'table' then @@ -104,8 +104,7 @@ local function cowrap(dispatcher, tcp, error) -- don't override explicitly. local metat = { __index = function(table, key) table[key] = function(...) - arg[1] = tcp - return tcp[key](base.unpack(arg)) + return tcp[key](tcp,select(2,...)) end return table[key] end} diff --git a/test/utestclnt.lua b/test/utestclnt.lua index eec6adc..01f55e5 100644 --- a/test/utestclnt.lua +++ b/test/utestclnt.lua @@ -4,24 +4,24 @@ local socket = require"socket.unix" host = "luasocket" function pass(...) - local s = string.format(unpack(arg)) + local s = string.format(...) io.stderr:write(s, "\n") end function fail(...) - local s = string.format(unpack(arg)) + local s = string.format(...) io.stderr:write("ERROR: ", s, "!\n") socket.sleep(3) os.exit() end function warn(...) - local s = string.format(unpack(arg)) + local s = string.format(...) io.stderr:write("WARNING: ", s, "\n") end function remote(...) - local s = string.format(unpack(arg)) + local s = string.format(...) s = string.gsub(s, "\n", ";") s = string.gsub(s, "%s+", " ") s = string.gsub(s, "^%s*", "")