问题标签 [lua-4.0]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
55 浏览

function - 将参数传递给 Lua 4 中的函数

我有一个函数可以接受任意数量的参数,然后用这些参数做一些事情。

例如,min(3,9,1,2)min(2,1)min(5,1,7)

但是,在 Lua 4 中,当我事先不知道会有多少参数时,如何从另一个例程中将参数提供给函数?也许我有一个包含一堆字符串的数组,但每次都是不同数量的字符串,我需要在得到任何结果之前将这些字符串作为参数传递给函数。

谢谢。