Posts tagged lua

Subscribe to this tag


Multiple return values from the __index meta method

Posted ·

You don't.

A test with upm found that an __index method declaring two return arguments is disregarded. They're somehow flattened into the same variable instead, but the normal x, y = func() syntax doesn't work, and x is still the same return type. The comparison of a normal function worked as expected with two return values, so this behavior is unique to __index (and possibly other meta methods).