It's slightly different. There's a post somewhere on WowAce where someone explained it in a bit more detail, but basically "local function x() end" works like "make a function named x, and then make it local" while "local x = function() end" works like "make a function, and then assign it to the local variable x"... it's executed from right to left, so with the latter, the function is defined first, and then the variable, so if you try to call "x" from inside the function, the "local x" part hasn't been defined yet, and you're looking for a global "x" which probably doesn't exist, and won't be what you want even if it does.
Code:
local function print(x)
UIErrorsFrame:AddMessage(x)
if x == "Hello" then
print("Hello to you too")
end
end
print("Hello")
^ The inner "print" refers to the "local function print", so both messages go to the UIErrorsFrame.
Code:
local print = function(x)
UIErrorsFrame:AddMessage(x)
if x == "Hello" then
print("Hello to you too")
end
end
print("Hello")
^ The inner "print" refers to the global "print", so "Hello" goes to the UIErrorsFrame, but "Hello to you too" goes to the DEFAULT_CHAT_FRAME.