On 13/06/2014 21:09, Tim Hill wrote:
What if we want raw unpacking of metatabled tables? (aka keep nil as
On 13/06/2014 20:10, Tim Hill
The OP has a point though (imho) … table.unpack() is
an iterated operation (internally), so the check for a
metamethod could be done ONCE and so incur very little
overhead for any non-trivial unpack operation, so you
can get both performance *and* flexibility.
We need a table.rawunpack(...)?
No, the OP pointed out that the overhead of doing the
metamethod test in table.unpack() is low, since it can be done
once at the start of unpack(), which then chooses a (fast)
rawgeti() based loop or a (generic) index metamethod loop. So
you get the best of both worlds in one API.