lua-users home
lua-l archive

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


On 20/12/2012 19:59, Geoff Leyland wrote:

Attached.  Note where "add" is required in expression.lua, after expression:new, but before the use of add.  It's not quite like this in the actual code, but this kind of problem does turn up.

I like this solution better.  I'll update my stackoverflow answer.

Setting package.loaded means that you don't have to return the module at the end of the module, but should you anyway?  Habits die hard.

Probably. I wouldn't be surprised if there's a Lua implementation out there somewhere that overwrites package.loaded.<modulename> with the return value (or true if none.) If you return the table, your module will be immune to this.