I am a pretty new user to developing with Lua and I am having some issues trying to set up an inheritance hierarchy with Lua. I have created the tables using some code that I found on the internet, but I do not really understand the code. It works, but my understanding says it shouldn’t. Basically, I have 3 tables: Entity, Model, and PropertySet. The Model and PropertySet tables are supposed to inherit the Entity table. From what I understand, if I set the __index metamethod in Model’s table to the Entity table, then if the Model table is invoked with an invalid key, it will look in the Entity table for the same key as long as that table is set in the Model’s __index field. Is this correct? If so, could anyone give me some sample C/C++ code to show how you actually set the __index field to refer to a table?
Thank You in Advance!