lua-users home
lua-l archive

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



On 2 October 2013 09:27, Tim Hill <drtimhill@gmail.com> wrote:
Scenario: I'm writing a 3rd party API that expects a sequence as an argument. For example:

sum = addSeq(t)
The addSeq() function adds all the values in the sequence in the table t, returning the total.
>>It's EXPENSIVE to check that a table is a sequence and therefore EXPENSIVE to create a robust API in this case.


Just pointing out that your scenario is flawed. You are going to iterate over the array entries to find the resulting sum.

--Liam