关于lua5.4中table.getn方法不能用的代替方案
table.getn用于获取数组长度,但lua5.0以上版本去除了table.getn方法,可使用如下替代方案:table.getn = function(args) local n = 0 if args then n = #args end return nend--测试样例function test(...) arg = {...} local len = table.getn(arg) print("arg len is ".. len) for a = 1,len
原创
2021-02-21 23:25:23 ·
809 阅读 ·
0 评论