4

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
2
  • 3
    There are no function declarations in Lua, only function definitions. Commented Jul 19, 2013 at 19:25
  • 1
    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. Commented Jul 19, 2013 at 19:49

1 Answer 1

2

As seen in 2.5.9 of the reference manual,

The statement

 function f () body end

translates to

 f = function () body end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.