lua-users home
lua-l archive

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


On Sun, Sep 14, 2014 at 2:47 PM, Mike Nelson <mikestar1313@gmail.com> wrote:
> Does anyone have an example of using the pathological case
>
> a,a,a=1,2,3
>
> or similar in real code (except as a coding error)? I can't think of a use
> case for using the same variable more then once
> on the left side of a multiple assignment.
>
> -- Mike

I can't imagine any way it wouldn't be a bug if you did do it, but a
realistic way I could see such a thing arising unintentionally is
like:

tbl[a], tbl[b], tbl[c] = k1, k2, k3

where a, b, and c are determined by some logic external to the
function. If any of a, b, or c are the same value, you trigger this
behavior.

/s/ Adam