# Love2D: Calling two files

Okay so i have two files one named Player.lua and one named Main.lua

Main:

function love.load()
end

function love.update()
end

function love.draw()
end


Player:

function player.load()
end

function player.update()
end

function player.draw()
love.graphics.setColor(255, 0, 0)
love.graphics.rectangle("fill", 50, 50, 50, 50)
end


Output is just a black screen!

• Hello, Ras. M, and welcome to Game Development! Maybe you can improve your question by expanding the description of your work, and better addressing your issues, so that we can better understand and help you. – liggiorgio Jun 8 '16 at 9:47

The main.lua file is automatically executed from the Löve application and the overriden functions love.load, love.update and love.draw get called.

This means that if in your main.lua file you've included the love.load function, at the start of the game that function is called; then, if there's a love.update function, it gets called too, then the love.draw if it's present, and then back to update, draw, update, and so on.

So the player.lua file will never gets executed, unless you tell the program to execute it from main.lua.

main.lua

function love.load()
require "player.lua"