Use table variable in Lua class
问题 I need a table variable in a Lua class, which is unique for each instance of the class. In the example listed below the variable self.element seems to be a static variable, that is used by all class instances. How do I have to change the testClass to get a non static self.element table variable? Example: local testClass ={dataSize=0, elementSize=0, element = {} } function testClass:new (data) local o = {} setmetatable(o, self) self.__index = self -- table to store the parts of the element