lua-users home
lua-l archive

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


Well, I stand corrected!  :)

I guess in this situation there is a disconnect between the table.sort
behavior and iterator behavior.

*reads up the thread*

Cheers,
Ben

On Feb 11, 2008 7:32 PM, Eric Tetz <erictetz@gmail.com> wrote:
> On Feb 11, 2008 6:30 PM, Ben <thebassplayer@gmail.com> wrote:
> > Back to the point, callables and such... seem against the Lua Way from
> > what I see
>
> I think in particular case, not enforcing type is more the "Lua Way".
>
> As I mentioned earlier, Lua doesn't care about the types of values in
> a table to be sorted. As long as the values being compared are the
> same type and support the < operator, they can be sorted. That kind of
> generic programming is one of the great strengths of dynamically typed
> languages. Writing a similarly generic sort function in, say, C++
> requires the use of templates or a class hierarchy.
>