[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: unexpected syntax error
- From: Matthias Kluwe <mkluwe@...>
- Date: Wed, 28 Nov 2012 19:23:14 +0100
Hi!
2012/11/28 Rob Kendrick <rjek@rjek.com>
>
> On Wed, Nov 28, 2012 at 05:17:28PM +0100, Matthias Kluwe wrote:
> > I played around trying to create a small DSL and stumbled upon an
> > unexpected behaviour. This is a small example:
> >
> > local function f()
> > return setmetatable( {}, {
> > __div = function( t, arg )
> > print( arg )
> > end } )
> > end
> >
> > f{} / 'a'
>
> That's because this is an expression, not a statement. It doesn't work
> as f() / 42, either. You need to specify where to put the result, or
> use it in a flow control structure.
Ah, yes, thank you. My thinking was still in C++-mode.
Regards,
Matthias