[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Feature request: userdata slice
From:       Dirk Laurie <dirk.laurie () gmail ! com>
Date:       2015-08-22 5:48:27
Message-ID: CABcj=tmzd63gMpGSe4maoayar7OyZtB4hrzRxca2TyneOUMxVQ () mail ! gmail ! com
[Download RAW message or body]

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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic