MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lua/comments/1u0fau3/lua_serpent_module/oqkm8a5/?context=3
r/lua • u/Financial_Owl2289 • Jun 08 '26
:-)
48 comments sorted by
View all comments
1
Avoid using pairs in 5.2+? Wha? just because you don't want to use __pairs?
2 u/arkt8 Jun 09 '26 I found this very interesting as I never think it before...He is avoiding the Lua pairs() as it may trigger the pairs metamethod in Lua 5.2.I would just not override the pairs() but named it rawpairs() to make it explicit. 1 u/Old_County5271 Jun 09 '26 Completely crazy, __pairs is there because lua does not have arrays! traversal needs to be controlled!
2
I found this very interesting as I never think it before...
He is avoiding the Lua pairs() as it may trigger the pairs metamethod in Lua 5.2.
I would just not override the pairs() but named it rawpairs() to make it explicit.
1 u/Old_County5271 Jun 09 '26 Completely crazy, __pairs is there because lua does not have arrays! traversal needs to be controlled!
Completely crazy, __pairs is there because lua does not have arrays! traversal needs to be controlled!
1
u/Old_County5271 Jun 08 '26
Avoid using pairs in 5.2+? Wha? just because you don't want to use __pairs?