[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: module inheritance example?
- From: James McLaughlin <jomclaughlin@...>
- Date: Mon, 22 Mar 2010 16:38:49 -0500
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?