I've seen some scripts with Variable=function()
what difference does it have between function Name()
?
Your question has been adequately answered already, but to remove it from the Unanswered sort category, I'm going to a write a full answer.
There is absolutely no difference between:
function funcName() end
and:
funcName = function() end
In fact, the former is actually just syntactic sugar for the latter!
When using Tables, either form works except for once case:
local tab = {} function tab.funcName() end --valid tab.funcName2 = function() end --valid tab["funcName3"] = function() end --valid (Also lets you make functions with non-string identifiers) function tab["funcName4"]() end --INVALID --This is the only case where the sugar doesn't work. I'm not sure *why* it doesn't work, but I've tested it before and it provably does not work.
Locked by woodengop, alphawolvess, and adark
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?