Interesting thing about local insertNameHere = function()

Up until this point i’d thought that

[lua]local insertNameHere = function()[/lua]

was the same as

[lua]local function insertNameHere()[/lua]

People have discussed memory and which is faster and as far as I was aware they are equal.

Well today I discovered, whilst creating a transition loop, that if I use a onComplete transition call to

[lua]local insertNameHere = function()[/lua]

Then it doesn’t work. But if it is laid out the other way then it works just fine. Here is the exact code I was working on. With the working method

[lua]local function moveSurfaceWater()

local surfaceBackward = function()

surfaceWaterTween = transition.to( surfaceWater2, { time=2000, x=-30,
onComplete = moveSurfaceWater })
print(“yes”)

end

print(“is it too late for this?”)

surfaceWaterTween = transition.to( surfaceWater2, { time=2000, x=-10, onComplete =
surfaceBackward } )

end[/lua]

Can anyone shed any light on why this is and should I change all my functions to call like this?
Cheers

Cell [import]uid: 26289 topic_id: 20692 reply_id: 320692[/import]

I think it is the phenomenon explained here:
http://www.lua.org/pil/6.2.html
[import]uid: 7563 topic_id: 20692 reply_id: 81464[/import]