简体   繁体   English

lua-如何创建函数

[英]lua - how to create functions

I have a question about declaring functions in lua. 我对在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

As seen in 2.5.9 of the reference manual , 参考手册 2.5.9所述,

The statement 该声明

 function f () body end

translates to 转换为

 f = function () body end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM