lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Does anyone have a good example of a module inheriting from another module? A limited google on my part didn't turn up anything good, making me think it might not be considered good practice. I saw a couple of examples passing extra functions to the module function, but the manual is extremely thin on this matter. It seems that these functions accept the module table as a param, and then can add and remove table entries before it is returned by require. Another option would be to set the metatable of the derived module to a table with __index pointing to the base module. Any advice on why one would be chosen over the other?