Using _ is usually for return values ββthat you do not want to use from a function . What makes sense is like a space. The reason it is commonly used in iteration is because most iterators return key pairs, values, and you only need a value.
However, _ can also be used for the exact opposite. When placed behind a variable, such as _G or _VERSION , this means that it is important and should not be changed.
And finally, double underlining. I used them only for metamethods such as __index or __add , so if you are creating a function or API or something that checks your own metamethod, be sure to use consistent double underscores.
So, in the end, it's just a naming convention, and it's completely self-confident and optional.
source share