Hello im new to love and having some issues with nil value error
Posted: Wed Jan 20, 2016 10:30 pm
im trying to fallow this tut and everything is written the same but for some reason his will work in the video and mine ends up with nil value errors left and right
this is the code i am working with
the error seems to be with the r1:load
this is the code i am working with
Code: Select all
local Renderer = require "tools/renderer"
renderer = Renderer:create()
function createBox(x,y)
local b ={}
b.x = x or 0
b.y = y or 0
function b:load()
renderer:addRenderer(self,1)
end
function b:draw()
love.graphics.setColor(math.random(0,255),math.random(0,255),math.random(0,255))
love.graphics.rectangle("fill",self.x,self.y,64,64)
end
return b
end
function love.load()
rl = createBox(64,64)
r2 = createBox(96,96)
r1:load()
r2:load()
end
function love.update(dt)
end
function love.draw()
renderer:draw()
end