lua-users home
lua-l archive

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


2014-09-10 17:38 GMT+02:00 Robert McLay <mclay@tacc.utexas.edu>:
> Thanks all.  It is clear that this is safe to use.  At least until there is
> a good reason to remove support for it in later releases.
>
> I get that ("5",x,y) is going to return "5".  What I don't get is why then
> is:
>
>    s = '5':rep(4)
>
> does not work but
>
>    s = ('5'):rep(4)
>
> does.

prefixexp ::= var | functioncall | ‘(’ exp ‘)’

functioncall ::=  prefixexp args | prefixexp ‘:’ Name args

Since '5' is neither a variable nor a function call, it needs parentheses.