lua-users home
lua-l archive

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


> [...] Is there some way to do assignment inside
> an expression like this, and if not, why not?

Why not?
The main reason is syntactical. Assignments inside expressions would create
many syntactical ambiguities in the language. For instance, the constructor
{x=3, y=4} could be interpreted in the current way, or as a list of two
expressions, x=3 (value 3 to be stored in index 1) and y=4 (value 4
in index 2). As lhf said, you can do something "equivalent", but with
another syntax (calling a function).

-- Roberto