lua-users home
lua-l archive

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


On Tue, Aug 18, 2015 at 7:51 PM, Pierre-Yves Gérardy <pygy79@gmail.com> wrote:
>
> On Mon, Aug 17, 2015 at 8:57 PM, Mason Bogue <scythe+lua@ortsz.com> wrote:
>>
>> The proposal is this:
>>
>> str1 / str2 -- equivalent to str1:match(str2)
>>
>
> No time to test right now, but AFAIK, binary operators return exactly one value whereas function calls can return an arbitrary number of them.
>

I remembered correctly, this is a bytecode limitation:

> t = setmetatable({}, {__div = function() return 1, 2 end})
> = t / t
1

So this syntax would be useless for patterns that return more than one
value, unless you change the VM to support more than one return values
for operators.

—Pierre-Yves