4
votes

I have a question about declaring functions in lua.

I was under the impression that public functions are declared as:

abc = function()
end

Local/private functions as:

local abc = function
end

But I'm not sure what this notation is:

function abc()
end
1
There are no function declarations in Lua, only function definitions. - lhf
There are no public or private functions in Lua, only function values. Variables are either global or local and can reference any type of value, including functions. - Tom Blodget

1 Answers

2
votes

As seen in 2.5.9 of the reference manual,

The statement

 function f () body end

translates to

 f = function () body end