lua-users home
lua-l archive

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


Miles Bader wrote:
> However I've just realized that some things _don't_ return an
> appropriate table from require.  In particular swig-generated
> interfaces seem to simply return the string "whatever"!  I could
> swear this _used_ to work with swig-generated interface, but it's
> been some months since I last did something that would test that.    
> 
> So, what exactly _is_ the recommended way to do this?

I think it is to return a table containing the module functions. However
require can load code that are not modules, and there may be no such
table. See the manual of require to see what it does exactly.

> Is swig being bad by returning a string instead?

It's not following the informal convention used by most Lua modules. Is
it bad to be different ?

> Should I change my style of using modules?

Each module has it's own usage rules, I don't think you can generalize
module usage without at the same time restricting what modules you can
use.