lua-users home
lua-l archive

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


On Thu, Jul 31, 2014 at 11:48 AM, Andrew Starks <andrew.starks@trms.com> wrote:
>
>
>
> On Thu, Jul 31, 2014 at 1:30 PM, Luiz Henrique de Figueiredo
> <lhf@tecgraf.puc-rio.br> wrote:
>>
>> Lua 5.3.0 (alpha) is now available for testing at
>>         http://www.lua.org/work/lua-5.3.0-alpha.tar.gz
>>
>> MD5     2922a0c3b64c8a2f678d2510b7a5a336  -
>> SHA1    b2f86c16a38310c9e240c70216618308097444f6  -
>>
>> This is an alpha version. Some details may change in the final version.
>>
>> The main change in Lua 5.3.0 is the introduction of integers. See also
>>         http://www.lua.org/work/doc/#changes
>>
>> The complete diffs are available at
>>         http://www.lua.org/work/diffs-lua-5.3.0-work3-alpha.txt
>>
>> All feedback welcome. Thanks.
>> --lhf
>>
>>
>
>
> Yay!
>
> I read through the definition of "table.copy" and I don't grasp it. I assume
> that the updated reference isn't complete. The definition is:
>
> table.copy (a1, f, e, [a2,] t)
>
> Reading the text, I think that:
>
> a1 is source
> a2 is target. if a2 is missing then a1 is used.
> t is the target index's start, such that the first index to be copied.
> (shouldn't this default to 1 or f?)
> f is "first"?
> e is "end"?
>
> so:
>
> table.copy(source, 1, 10, destination, 5)
>
> would copy index 1 ... 10 into the table 'destination', starting at index 5
>
> Is that correct? Is this interface mimicking some pattern that I haven't
> seen before? I didn't find this easy to read or understand.
>
> -Andrew

See I thought the reverse -- if you plan to use the 'table' library
for your own supertype of tables, you'd want the first argument to be
the destination, so you can do: some_table:copy(source, ...) --
some_table being the destination, the table copied into