Posts tagged lua

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). Fuck knows what Lua actually does in this context, but it does not respond well to __index returning multiple arguments.