Multiple return values from the \_\_index meta method

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.

Use a table if you absolutely have to return multiple values from __index, or use normal functions instead. As already mentioned, normal functions are able to return multiple arguments. It's just __index that misbehaves.


All comments posted either through or manually on the associated GitHub issue end up on an associated issue in the website GitHub repo, and as such are required to follow the project code of conduct. Remember this while writing comments.