lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, list

How to comprehend "in Lua, all functions are anonymous. Like any other
value, they do not have names. " at a deeper level?

I know that the named function syntax function add(a,b) return a+b end
is actually a syntactic sugar for add = function(a,b) return a+b end.
And I  understand that you can specify the sorting order for
table.sort() by anonymous function.

Why does Lua prefer to anonymous functions, unlike the functions in C?
What're the advantages comparing with providing non-anonymous function syntax?

Thank you for your attention to my question.
Looking forward to hearing from you.

Best regards
Sunshilong