- 链接地址:https://blog.csdn.net/weixin_30905655/article/details/112833155
- 链接标题:lua 函数 默认值_定义函数参数的默认值-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:6332
文章浏览阅读2.4k次。如果你想要命名参数和默认值,如PHP或Python,你可以使用表构造函数调用你的函数:myfunction{a,b=3,c=2}函数本身可以有这样的签名:function myfunction(t)setmetatable(t,{__index={b=7,c=5}})local a,c =t[1] or t.a,t[2] or t.b,t[3] or t.c-- function continue..._lua 函数参数默认值
版权声明:本文发布于特牛网址导航 内容均来源于互联网 如有侵权联系删除
标签:lua 函数参数默认值