lua-users home
lua-l archive

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


On Sun, Feb 23, 2003 at 10:12:52PM -0300, Luiz Henrique de Figueiredo wrote:
> >I was playing around with calling functions without the brackets, if
> >they take only one parameter, and it is a string or table this evening.
> >
> >  function user(t)
> >    ...
> >  end
> >
> >  user { name = "Joe Bloggs", password = "wibble" }
> >
> >Works, where adding another function, say:
> >
> >  function hosts(t)
> >    ...
> >  end
> >
> >  user { name = "Joe Bloggs", hosts { "jbloggs.bigco.com" } }
> >
> >Does not.  Which seems a shame.  Is it me just getting something rather
> >stupidly wrong, or can I not do this?  Is there an alternative method in
> >the same vain?  (this is for a configuration file.)
> 
> In what sense does this second example not work? Perhaps hosts 
> should return t?

error: `=' expected;
last token read: `{' at line 1 in string "user { name = "Joe Bloggs", hosts {"jbloggs.bigco.com" } }"

Axel Mamode seems to have hit the nail on the head, pointing out that I
need to seperate them with a semicolon.  Which is also a shame. :-/

Oh well, I'll just use = for now. :)

Ta all.
-- 
Rob Kendrick                                       http://www.pepperfish.net/
PGP signed or encrypted mail welcome                         Key ID: 3651D17A