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
beginner OOP problem with rxi classic
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: beginner OOP problem with rxi classic
You need : in the second call:
I think this may work as well:
Code: Select all
scene = Stage:new("splash")
Code: Select all
scene = Stage("splash")
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests