i recently tried out luas Pseudeo OOP Mechanics. I want to call a function inside to tables which write a value into a variable in their Tables. I tried using the self variable. Here is my Code:
local Table = {}
Table.value = 0;
function Table:myfunc(Parameter)
self.value = Parameter;
end
local Table1 = Table;
local Table2 = Table;
Table1:myfunc("1");
Table2:myfunc("2");
print(Table1.value)
print(Table2.value)
The Problem is, that it prints 2 both times. If i print out the parameter iside the function, then it shows 1 and 2, exactly what i want. So what am I doing wrong?
(and sorry if im writing this in the wrong place, this is my first post here :))
Any help would be appriciated.
Greetings