Director Class (director.lua) in Subdirectory

Hi Guys,

I’ve been trying to organize my code a little better now that the daily builds support placing .lua files in subdirectories.

I’ve created a lib folder where I’ve placed all the libraries that I’m using (ui.lua, movieclip.lua etc…) however I’m getting the following error from the Director Class:

Runtime error  
 ...sers/ahamidi/Dev/Corona/game/lib/director.lua:257: attempt to index global 'director' (a nil value)  

Looking at line 257, I can see that’s the first point in the director file that a director method is created I.e.

function director:changeFxTime( newFxTime )  
 if type( newFxTime ) == "number" then  
 fxTime = newFxTime  
 end  
end  

I’m requiring director using director = require("lib.director") .

I’ve noticed however that if I assign lib.director back to director, within director.lua, everything seems to work.

That’s obviously not a great way to do things so anything help would be greatly appreciated.

Ali
[import]uid: 10499 topic_id: 16612 reply_id: 316612[/import]

Yeah I just got this problem when I start trying to organise things better. Better leave it all messed up!

What do you mean by:
I’ve noticed however that if I assign lib.director back to director, within director.lua, everything seems to work.

What exactly did you do?
[import]uid: 51622 topic_id: 16612 reply_id: 118810[/import]

Actually, since then I’ve switched to use the Corona Storyboard API.

This was quite awhile ago, so I can’t really remember what I did to be honest.

Ali [import]uid: 10499 topic_id: 16612 reply_id: 118811[/import]