Just to give you an idea:
function foo()
print("Foo.")
end
is exactly the same as
foo = function()
print("Foo.")
end
and
local function foo()
print("Foo.")
end
is exactly the same as
local foo = function()
print("Foo.")
end
** with a small difference:
The first (function foo()) makes foo a global variable, and the other (local function foo()) makes foo a local variable. With that being said, as with any other variable, you should always declare functions as local.