title: Calling (importing) other .lua files outside main.lua in Love2D
body: <p>So, I wanted to clean up my code by splitting it into seperate files. But for some reason I can't call the script I want to call through my main.lua.</p>
  
  <p>Here's my main.lua script:</p>
  
  <pre class="lang-lua prettyprint-override"><code>function love.load()
    require "splash.lua"
    splash.load()
  end
  
  function love.update(dt)
    splash.update(dt)
  
  end
  
  function love.draw() print("Draw")
    splash.draw()
    love.graphics.print("FPS "..tostring(love.timer.getFPS( )), 5, 5) print("fps")
    love.graphics.setColor(255,0,0) --Red
    love.graphics.rectangle("fill", 3, 3, 60, 20)
  end
  </code></pre>
  
  <p>And here's my splash.lua script, separate from the main.lua file:</p>
  
  <pre class="lang-lua prettyprint-override"><code>function splash.load()
      timer = 0 print("fadein")
      alpha = 0
      fadein  = 2
      display = 4
      fadeout = 6
      splashScreen = love.graphics.newImage("/images/Splash1.png")
  end
  
  function splash.update(dt)
      timer = timer + dt
      if 0 &lt; timer and timer &lt; fadein then
          alpha = timer / fadein
      end
      if fadein &lt; timer and timer &lt; display then
          alpha = 1
      end
      if display &lt; timer and timer &lt; fadeout then
          alpha = 1 - ((timer - display) / (fadeout - display))
      end
  end
  
  function splash.draw()
      love.graphics.setColor(1, 1, 1, alpha)
      local sx = love.graphics.getWidth() / splashScreen:getWidth()
      local sy = love.graphics.getHeight() / splashScreen:getHeight()
      love.graphics.draw(splashScreen, 0, 0, 0, sx, sy)
  end
  </code></pre>
  
  <p>I've searched everywhere on this topic, and the other answers are either extremely vague or outdated. All I want to do is to make the splash.lua run when I start Love.</p>