Page 1 of 1

Requiring Class doesn't work anymore

Posted: Sat May 28, 2011 2:44 pm
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

Re: Requiring Class doesn't work anymore

Posted: Sat May 28, 2011 3:23 pm
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