I have two Lua files, one of which is main.lua:
require "player"
require "level"
function love.load()
end
function love.draw()
rectangle_draw()
end
and another called player.lua:
function rectangle_draw()
love.graphics.setColor(223, 202, 79)
love.graphics.rectangle("fill", 20, 20, 32, 48)
end
As you can see, I'm trying to use the rectangle_draw()
inside of love.draw()
function, hoping it to draw a rectangle in specific location etc etc, but whenever I try to run my little program I get this error:
attempt to call global 'rectangle_draw' (a nil value)
Traceback
main.lua:9: in function 'draw'
[C]: in function 'xpcall'
What am I doing wrong?