function – 我不明白的Lua语法片段
我正在使用基于Lua的产品,我正在使用他们的API,并且在那里有一些我不理解的语法.
这是什么? 它是Add的函数定义 – 看起来很奇怪,没有任何实现并指定输入表中的内容? 添加包含表格的表格?我从未见过用括号而不是花括号创建的表格? serviceDefinitions.Add( input { name="p1",baseType="NUMBER",description="The first addend of the operation" },input { name="p2",description="The second addend of the operation" },output { baseType="NUMBER",description="The sum of the two parameters" },description { "Add two numbers" } ) 解决方法
当调用只有一个参数是表或字符串的函数时,可以省略括号.从
manual:
这意味着以下函数调用有效: somefunction({1,2,3,4}) somefunction{1,4} 或者,使用字符串: print('hello!') print 'hello!' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |