Director Class + Lime + Memory Management

No problems indeed. Take your time. [import]uid: 11904 topic_id: 6106 reply_id: 22720[/import]

Hey Graham, See the following for changes in the Director

http://developer.anscamobile.com/forum/2011/02/02/any-idea-when-v12-might-come-out#comment-22751

Hope this helps. [import]uid: 11904 topic_id: 6106 reply_id: 22813[/import]

Here is what I have found, if it helps …

The viewer code that Graham sent out had what looked like ver 1.1 of director
But it is different than the 1.1 from Ricardo ???
Ver 1.1 from Graham (with viewer) - THIS WORKS


– LOAD SCENE

local function loadScene ( nextScene )

if currentScreen then
currentScreen:onHide()
end

nextScreen = require(nextScene).new()
nextView:insert(nextScreen)

end

Ver 1.1 from Ricardo - causes ERROR, as does file with ver 1.2

– LOAD SCENE

local function loadScene ( nextScene )

nextScreen = require(nextScene).new()
nextView:insert(nextScreen)

end
Here is the first error caught…

Runtime error
…xCETaaQfpBhUg6xk+++TI/TemporaryItems/15/lime-map.lua:807: attempt to perform arithmetic on field ‘x’ (a nil value)
stack traceback:

Hope that helps,

Peter [import]uid: 13932 topic_id: 6106 reply_id: 22864[/import]

Changing the following two lines seems to make lime work with director 1.2:

lime-utils.lua (80):
[lua] return worldToGridPosition(map, {x=position.x - (map.world.x or 0), y=position.y - (map.world.y or 0)})[/lua]

and

lime-map.lua (807):
[lua] self:setPosition((self.focus.object.x or 0) + (self.focus.xOffset or 0), (self.focus.object.y or 0) + (self.focus.yOffset or 0))[/lua]

-FrankS.

PS. I’m not familiar with the lime code (started this afternoon…), so no guarantees… [import]uid: 8093 topic_id: 6106 reply_id: 22885[/import]

I had put in a small change just to allow me to deal with cleaning stuff up before the scene was destroyed by Director but looking at the link from ksan it looks like Ricardo has added in a clean() function that will do exactly what I want. [import]uid: 5833 topic_id: 6106 reply_id: 22944[/import]

Yup, all fixed now. Just change the two onHide functions declarations (in screen_Map and screen_MapList) to “function clean()” and all will be sorted.

The new version of the viewer app will be uploaded soon as well as included with Lime 2.8 [import]uid: 5833 topic_id: 6106 reply_id: 23561[/import]

Awesome - sounds good Graham! [import]uid: 13932 topic_id: 6106 reply_id: 23569[/import]

Working great now! Thanks much!!! [import]uid: 11904 topic_id: 6106 reply_id: 23724[/import]

Awesome, thanks for checking and getting back to me! [import]uid: 5833 topic_id: 6106 reply_id: 23725[/import]