lua-users home
lua-l archive

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



On Jun 28, 2007, at 22:05, Rici Lake wrote:

function replace_empty_with_nil(...)
  local args = {n=select("#", ...), ...}
  for i = 1, args.n do
    if args[i] == "" then args[i] = nil end
  end
  return args
end
someArguments = replace_empty_with_nil(f())
aHandler(unpack(someArguments, 1, someArguments.n))

Thanks for the detailed explanation, the fog of confusion is slowly dissipating now... :)

Cheers,

PA.

P.S. Yes, the subtraction in the initial code was indeed intentional.