lua-users home
lua-l archive

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


> 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"?

Yes.


> so:
> 
> table.copy(source, 1, 10, destination, 5)
> 
> would copy index 1 ... 10 into the table 'destination', starting at index 5
> 
> Is that correct?

Yes.


> Is this interface mimicking some pattern that I haven't seen before?

Not that we know. Do you suggest something else?


> I didn't find this easy to read or understand.

:(  (Well, in the end you did understand it all, correctly :)

-- Roberto