lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, 24 Mar 2011 14:53:57 +0300, Alexander Gladysh wrote:

{
 { "OK", error_value, 4 },
 { "status", "error", "integer" }
}

In this case, why the outer table? Make it two return values.

That's what I actually had on my mine.

However — is this comfortable to work with from the user's point of view?

I think so. If you don't need error handling you simply don't use the
second value, and if you do you go:

local res,err = redis_call()
for i=1,#err do
  if err[i] == "error" then
    ...
  else
    ...
  end
end

--
Pierre 'catwell' Chapuis