title: Calling functions on require()d modules in Lua gives me "attempt to index local 'x' (a boolean value)"
body: <p>I've read PIL and the <a href="http://lua-users.org/wiki/ModulesTutorial" rel="nofollow">ModulesTutorial</a> on creating modules but I'm having trouble <code>require()</code>ing them correctly.</p>
  
  <p>Here is my setup:</p>
  
  <pre><code>-- File ./lib/3rdparty/set.lua
  local ipairs = ipairs
  module( "set" )
  function newSet (t)
    local set = {}
    for _, l in ipairs(t) do set[l] = true end
    return set
  end
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>-- File ./snowplow.lua
  local set = require( "lib.3rdparty.set" )
  module( "snowplow" )
  local SUPPORTED_PLATFORMS = set.newSet { "pc", "tv", "mob", "con", "iot" }
  </code></pre>
  
  <p>Then if I run <code>snowplow.lua</code>:</p>
  
  <pre><code>lua: snowplow.lua:4: attempt to index local 'set' (a boolean value)
  stack traceback:
    snowplow.lua:4: in main chunk
    [C]: ?
  </code></pre>
  
  <p>What am I doing wrong in my module definition - what is the boolean exactly? Also, if I append a <code>return _M;</code> at the bottom of my <code>set.lua</code>, then everything starts working - why?</p>