lua-users home
lua-l archive

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


Greetings!

I am looking for a way to pass table assignments directly in
a function call.  Given that a varargs function simply produces
a table 'arg', I was hoping this might have been possible.
I am trying to achieve syntax like:

function xyzzy(...)
...
end

a = xyzzy(A = 1, B = 2)


Is there any way to achieve this?  I currently have:

function xyzzy(tbl)
...
end


a = xyzzy({ A = 1, B = 2})

But as these calls are for end-user (ie non-programmer) usage,
I really want to reduce the confusion and clutter of the extra
braces if possible.

Thanks!

Love, Light and Peace,
- Peter Loveday
eyeon Software