title: Lua - How do I dynamically call a module?
body: <p>Here's some much-simiplified Lua code I'm working with.  I need to know how to dynamically call another module ('zebra'):</p>
  
  <pre><code>avar = require "avar"
  bvar = require "bvar"
  
  function create(zebra)
    print(zebra.new())
  end
  
  print(create(avar))
  </code></pre>
  
  <p>And here are two modules:</p>
  
  <pre><code>local Avar = {}
  
  function Avar.new()
    return "avar"
  end
  
  return Avar
  
  local Bvar = {}
  
  function Bvar.new()
    return "new"
  end
  
  function Bvar.old()
    return "old"
  end
  
  return Bvar
  </code></pre>
  
  <p>If I try to pass in the string "avar" to my 'create' function, it doesn't work.  If I pass in the word 'avar' with no quotes, it does work, however, I don't understand what avar with no quotes is?  It seems to be a blank table?  Not sure how to pass a blank table as an argument in my main program.</p>
  
  <p>But maybe I'm totally on the wrong path.  How do I dynamically call modules?</p>