title: How to export, then access exported methods in Lua
body: <p>I have a file, display.lua in which I have code to load some resources.</p>
  
  <pre><code>----display.lua
  Resources = {}
  
  function Resources:new(rootdir)
    local newObj = {image = {}, audio = {}, root = ""}
    newObj.root = rootdir
    return setmetatable(newObj, self)
  end
  
  function Resources:getSpriteSheet(name)
      --- etc etc etc
  end  
  </code></pre>
  
  <p>and then I have a game variable I use to store gamestate, this is within another file game.lua.</p>
  
  <pre><code>---game.lua
  require "display.lua"
  
  function Game:new()
    local newObj = {mode = "", map = {}, player = {}, resources = {}}
    self.__index = self
    return setmetatable(newObj, self)
  end
  
  function Game:init()
    self.resources = Resources:new("/home/example/etc/game/")
    local spriteSheet = self.resources:getSpriteSheet("spritesheet.png")
  end
  </code></pre>
  
  <p>I have access to the resources code via use of <code>require</code>. My issue is that within <code>Game:init()</code> I can't access <code>Resources:getSpriteSheet()</code>, the lua interpreter complains of "attempt to call method (getSpriteSheet) a nil value"</p>
  
  <p>I assume here I would have to export the methods in Resources but I don't know how I'd go about doing this, as I'm quite new to Lua.</p>