For a while, I've tended to use require like:
local XX = require 'whatever'
XX.whatever()
This seems to work with almost every module I've tried it with, and
offers a nice sense of locality.
[The alternative, of course, is to assume the loaded package will
put a "whatever" entry in _G.]
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? Is swig being bad
by returning a string instead? Should I change my style of using
modules?