meta-method Questions
1
Solved
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 wa...
Corriveau asked 2/6, 2017 at 4:0
1
Solved
In general, the syntax:
for k, v in pairs(t) do
....
end
is equivalent to:
for k, v in next, t do
....
end
But what if t has a __pairs metamethod? Will the standard next() function check fo...
Tokharian asked 11/4, 2015 at 16:7
2
Does anybody know actual implementation of lua 5.2. metamethod __pairs? In other words, how do I implement __pairs as a metamethod in a metatable so that it works exactly same with pairs()?
I nee...
Plumate asked 13/5, 2014 at 6:34
1
© 2022 - 2024 — McMap. All rights reserved.