i have several instances of one object/class and i realized that this object has like 6 variants of a constructor function which are only invoked when the object is initialized. now what i don't know if these functions are stored for each instance separately? if yes, then probably i should make these functions global and change them so they give back a prepared fully constructed object. this way these functions would be in the memory once instead of 100 times.
as far as i remember in more oop-oriented languages you can decide if a function of a class is global or local in the sense that it is one for the whole class or one for each object. can you make such a differentiation with lua? and which case is happening by default?
my lack of understanding what is happening in the background goes farther of course, e.g. what if a function of the class is put on each onenterframe of each instance, then do we have 100 copies of this function in the memory or only 1? but maybe this works exactly the same way as my question above and making it an eventhandler does not change the number of functions in memory.
so probably there is an easy answer, please tell me.