When you define a function inside another function, if you don't explicitly mark it as "local" it will be assigned to a global variable, i.e.
function b()
print("goodbye!")
end
function a()
function b()
print("hello!")
end
end
b() -- "goodbye!"
a() -- over-writes b
b() -- "hello!"
This is not a good thing.