lua-users home
lua-l archive

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


2015-08-21 22:17 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
>
>> On Aug 20, 2015, at 11:43 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>
>>
>> The possibilities are legion!
>>
>
> Sadly so are the possibilities for abuse…
>
> a, b = get_two_integers()
> x, y = 1, 1
>
> print(a, b)
> -> 1 1
>
> print(x, y)
> -> 1 1
>
> print(x+y, a+b)
> -> 2 “Elephant”

One can do that easily with current Lua, by the simple expedient
of returning (despite the name) tables. If what is returned are really
integers as promised, no amount of individual metatable tinkering
will coax Lua into checking for the existence of __plus.