iolo72@ yes when you change scenes with director anything u put in the clean function will be cleaned at scene change.
jkrassman give u an example of what i was talking about earlier , but im home now so ill give you another example of a great way to access modules.
[lua]–gameFunctions.lua module
–First create a table to house all of the modules functions
local gameTable = { }
–Then create a local function
local function createRect ()
local ball = display.newRect ( 0, 0, 100, 50)
ball.x = display.contentWidth; ball.y = display.contentHeight;
end
–After you create the function then insert it into the table for the module
gameTable.createRect = createRect
–you can even do variables like this
local firstBoolean = true
–then insert the variable into the table
gameTable.firstBoolean = firstBoolean
–After you have inserted all functions and variables you want to access from outside modules then you return the table at he end of module like this
return gameTable[/lua]
now we go to the level module
[lua]–level module or any other module u want to access the gameFunctions module
–it is very easy to access the information on the other module
–just require in the module
local gameFunctions = require (“gameFunctions”)
–then create local variables to pull the info from the table
local createRect = gameFunctions.createRect
–Now you can use that function from a different module.
createRect()
–Same goes for the boolean, with one exception
local firstBoolean = gameFunctions.firstBoolean
–this will grab the current state of firstBoolean variable and use or display it, you cannot change the state of the boolean in the module unless u access it like this
print (gameFunctions.firstBoolean)
gameFunctions.firstBoolean = false
–Now u can change the state of the module variable by addressing it by its full name[/lua]
i hope this helps, i read a blog or a post on this and it helped me big time, it gets rid of the whole package.seeall deal
[import]uid: 126161 topic_id: 22455 reply_id: 89720[/import]