lua-users home
lua-l archive

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


> function f(a, b, c)
> a = a or (a == nil and my_default_a)
> b = b or (b == nil and my_default_b)
> c = c or (c == nil and my_default_c)

function f(a, b, c)
  a = a == nil and my_default_a or a
  b = b == nil and my_default_b or b
  c = c == nil and my_default_c or c

I think that looks more readable, although it doesn't place emphasis on
keeping the variable passed.