[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: inadequate documentation for select and table.unpack
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 21 Jun 2016 08:24:41 +0200
2016-06-21 2:20 GMT+02:00 Roberto Ierusalimschy <email@example.com>:
>> Could you explain why that happens? luaB_select is clearly O(1).
>> Does VARARG copy the arguments?
>> If so, why is that necessary?
> Any function call in Lua copies the arguments to the stack frame of
> the new function being called. You are all invited to do a better
One way is to make available the syntax `#...` and `...[k]` which would
not be syntactic sugar for `select` but would generate a VM instruction
VARARGK A B that puts into R(A) the k-th vararg (where k is computed
from R(B) with the usual rule for negative values) or the vararg length
of k=0. Of course, `...[k]=a` would still be illegal.