thanks @ar2rsawseen, it's only me using my own code, so scopes should not be too much of a problem anyway, i just try to follow best practices. your idea with _... seems best in this case.
@AhBadiane ... indeed, if you define a local function B inside a function Cl:B of the class Cl, then it is visible only inside THAT function Cl:B of the class and is not visible in OTHER functions (e.g. Cl:C) of the class. although you are right that it is not visible outside of the class, so it is a half-solution, but it is not what i needed.
That's not exactly a class property, but if you define
localfunction somefunc()end
inside the lua file where your class is, but outside of any function scope, this function seems to be visible only to all methods inside this file and not outside it.
Need to check more on memory management in this cases, but it could also be a feasible solution.
@AhBadiane and @ar2rsawseen, you maybe right indeed, then we have to add manually self to its parameters. and of course it is not as nice as having e.g. local MyClass:MyLocalFunction(...)
i wonder if it would make sense to add this to the class system of gideros, or it is not a good or doable idea. I don't need it desperately though, just wondering.
btw if i put a core class and 2 inherited classes in one lua file, then this method does not hide from each other the local functions of the inherited classes. moreover i cannot define a local function with the same name for each of them this way. of course if i split all up to 3 files, then it is a workaround.
Comments
@AhBadiane ... indeed, if you define a local function B inside a function Cl:B of the class Cl, then it is visible only inside THAT function Cl:B of the class and is not visible in OTHER functions (e.g. Cl:C) of the class. although you are right that it is not visible outside of the class, so it is a half-solution, but it is not what i needed.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
That's not exactly a class property, but if you define
Need to check more on memory management in this cases, but it could also be a feasible solution.
you maybe right indeed, then we have to add manually self to its parameters. and of course it is not as nice as having e.g.
local MyClass:MyLocalFunction(...)
i wonder if it would make sense to add this to the class system of gideros, or it is not a good or doable idea. I don't need it desperately though, just wondering.
btw if i put a core class and 2 inherited classes in one lua file, then this method does not hide from each other the local functions of the inherited classes. moreover i cannot define a local function with the same name for each of them this way. of course if i split all up to 3 files, then it is a workaround.
Fragmenter - animated loop machine and IKONOMIKON - the memory game