title: Lua: how do I return the module itself when requiring a module?
body: <p>I want to create a module something like this</p>
  <p>myclass.lua</p>
  <pre><code>local myclass = {
    print = function()
  `    print(myclass.name)
    end,
    setname = function(name)
      myclass.name = name
    end
  }
  
  -- Constructor
  local function new(name)
    local o = {name = &quot;&quot;}
    setmetatable(o, myclass)
    return o
  end
  
  return _this_module__  &lt;&lt;== How can I do this?:
  </code></pre>
  <p>In order to use this module like this:</p>
  <pre><code>myclasscode = require(&quot;myclass&quot;)
  
  local object1 = myclasscode.new(&quot;hello&quot;)
  local object2 = myclasscode.new(&quot;goodbye&quot;)
  </code></pre>