Requiring Class doesn't work anymore

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
xoher
Prole
Posts: 1
Joined: Sat May 28, 2011 2:25 pm

Requiring Class doesn't work anymore

Post by xoher »

Hello,

It's my first löve game and i just met my first big problem:


While i was cutting my project in several littles files, this error appear : Castle.lua:6 attempt to call global 'class'(a nil value)


Do you know the source of my problem?

(I join my project with my message. Just to describe it in few words : 5 Castles which shot bullets and several ships which move in a circle, the game has several 'states' which supposed to be the different part of the game.)

Thanks
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Requiring Class doesn't work anymore

Post by vrld »

Class is not a keyword in Lua. You will need to make 'class' known before using it. In your project, there are two libraries with two different class implementations - astar and hardoncollider. astar uses middleclass and hardoncollider uses hump.class:

Code: Select all

require 'astar.middleclass' -- to use middleclass
or

Code: Select all

class = require 'collision.class' -- to use hump.class
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 16 guests