Difference between . and : in Lua programming
Karl Xavier
Posted on January 4, 2024
The .(dot) operator in Lua is used to invoke the method of an object, and it is a widely used operator in Lua.
The :(colon) operator in Lua is used when you want to pass an invisible parameter to the method of an object that you are calling.
when we use the colon(:) operator what actually happens is that instead of calling v3 = returnX:fun1(100, 1)
what gets called is −
v3 = returnX:fun1(returnX, 100, 1)
and hence we get the output as an address, and so in the second case when we call returnX:bar(10,11) the second argument will be 10 and that’s what we get.
💖 💪 🙅 🚩
Karl Xavier
Posted on January 4, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
labex How to utilize Nmap script categories for vulnerability assessment in Cybersecurity?
November 24, 2024
undefined Criando o DevLinks: Um Projeto Simples para Alternar Idiomas e Temas na Web
November 23, 2024