Yes. There is hardly any equivalent of C++'s 'friend' keyword.
The reason why 'friend' isn't popular among OO practitioners, and missing from many (if not all) languages, stems mainly from claims that 'friend' hurts encapsulation. Although I tend towards Bjarne's side that the claim is false, I really think that it has limited use cases, and the usage of friend functions and classes can be implemented in a more OO-conforming way, eliminating the need of 'friend'.
As it is right now, a friend function to a class has access level similar to that of a method which is internal to the class. If there really is such a function which needs to be friends with a larger number of classes, I would prefer to create a base class which holds the function as a public method, and for the other classes to inherit from this class. Not only would this be a better design in most cases, it also increases the portability of your code, given the lack of 'friend' in other languages.
Thanks Vasilis Rekatsinas. I didn't even know VB was object oriented to start with. Good to know that VB has friends ;-) Gammelfleischvomtoasterschmecktgut I'm not sure if Lua has friend functions. Could you point me to a reference? BTW congratulations on having one of the longest usernames on Sololearn.
Thanks for the detailed answer Hatsy Rei . For friend functions of a single class, I always thought that public getters and setters could achieve the same purpose. In fact, there was also another question in the SL Q and A section which asked about the differences between getters/setters and 'friend's. But I felt that no one had really answered that question. Here is the link.
Idk if you have no local before a function it can be accessed anywhere but with local it can be accessed by stuff after it I think when the local function is at end it can fire another function and give local variables and variables without local can be accessed anywhere but if you define functions or variables without local it will have some delay I think and if you change a variable with local it will effect the stuff after it
Lua itself isn’t designed to be OO, but with metatables and metamethods its more powerful than python, at least in that sense, such as __index and __newindex can change the way a table(basically an array) behaves, allowing easy data management. So OOP is not all that bad with Lua.
Also, Lua is made with C, so it interacts with it via the stack very heavy, so not specifying if it’s local doesn’t mean anything can call it, you’d specify that by putting it in the global table(_G). With C or C++ you couldn’t push something that’s local to the top of the stack. Correct me if I’m wrong.