Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple inheritance chain error #1

Open
ddabrahim opened this issue Apr 30, 2022 · 0 comments
Open

Multiple inheritance chain error #1

ddabrahim opened this issue Apr 30, 2022 · 0 comments

Comments

@ddabrahim
Copy link

ddabrahim commented Apr 30, 2022

Hi.

I am trying to implement multiple inheritance but when I chain more than 2 classes it is cause LOVE to crash with the following error:

Error: [love "boot.lua"]:48: Failed to initialize filesystem: already initialized

I am uncertain if is it a limitation a bug or am I doing something wrong.
This is what I am trying to do:

createClass = require "createClass"

Car = createClass()
function Car:constructor(_wheels)
  self.wheels = _wheels
end

FamilyCar = createClass(Car)
function FamilyCar:constructor(_seats, _wheels)
  self.super.constructor(self, _wheels)
  self.seats = _seats
end

SportCar = createClass(FamilyCar)
function SportCar:constructor(_engine, _seats, _wheels)
  self.super.constructor(self, _seats, _wheels)
  self.engine = _engine
end

peugeot = FamilyCar(5, 4)
ferrari = SportCar("V8", 2, 4) --this is causing the crash

function love.draw()
  love.graphics.print(peugeot.wheels)
end

Here is a project that reproduce the problem:
multiple inheritance.zip

Using
LOVE 11.4
createClass.lua
macOS 12.3.1

I would appreciate any help.

Thank you.

@ddabrahim ddabrahim changed the title Multiple inheritance error Multiple inheritance chain error May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant