lua-users home
lua-l archive

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


> But now, if the previous statement was "i=a", we would have
>
>   i=a
>   (m1*m2):print()
>
> and the interpreter would read this as "i=a(m1*m2):print()" (as it
> actually does). I do not know any "elegant" solution to this problem.

Am I right in thinking you can put an optional ';' after a statement?

>From the manual...

4.5.1 - Blocks
A block is a list of statements, which are executed sequentially. A statement
may be optionally followed by a semicolon:
block ::= {stat sc} [ret]
sc ::= [';']

So you could do:

   i=a ;
   (m1*m2):print()