why can you set __index equal to a table

Viewed 472

The index metamethod can be set equal to tables. From what I can tell

foo.__index = function(self, k)
    return bar[k]
end

and

foo.__index = bar

are the same. Why is declaring functions this way allowed in this situation?

1 Answers
Related