beginner OOP problem with rxi classic
Posted: Sat Jan 18, 2020 4:08 pm
I am studing an OOP approach to develop my löve game so I included this library in my code:
https://github.com/rxi/classic/blob/master/classic.lua
my basic code is like this:
Object = require 'libraries/classic-master/classic'
function love.load()
Stage = Object:extend()
function Stage:new(name)
self.name = name
end
scene = Stage.new("splash")
end
that gives me error in ____ self.name = name ____ line telling me that I am attempting to index global a nil value...
Can someone kindly explain me what is it doing wrong and help me deduce what I have not understood in objects and reference or maybe just in the english sentence of the error message...
Thank you
https://github.com/rxi/classic/blob/master/classic.lua
my basic code is like this:
Object = require 'libraries/classic-master/classic'
function love.load()
Stage = Object:extend()
function Stage:new(name)
self.name = name
end
scene = Stage.new("splash")
end
that gives me error in ____ self.name = name ____ line telling me that I am attempting to index global a nil value...
Can someone kindly explain me what is it doing wrong and help me deduce what I have not understood in objects and reference or maybe just in the english sentence of the error message...
Thank you