lua-users home
lua-l archive

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

Hi all!
I was wondering whether it would be sensible to modify the table.sort function so that it returns its first argument.

This would allow to embed the call in an expression like the following:

use_the_sorted_array( table.sort( generate_the_array(x,y,z) ) )

I know it's easy to write a wrapper for it, but since table.sort doesn't currently return any value and that this behaviour seems quite intuitive (to me only?) the proposed modification shouldn't break any code or add noise (maybe it could also avoid using useless temporaries).

It doesn't seem to add much overhead either.

Best Regards,

-- Lorenzo