We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e187193 commit ccae8fdCopy full SHA for ccae8fd
src/lualib/CountVarargs.ts
@@ -3,7 +3,9 @@
3
import { __TS__IsLua50 } from "./IsLua50";
4
5
export function __TS__CountVarargs<T>(...args: T[]): number {
6
- // In Lua 5.0, the arg table includes trailing nils. In all other
7
- // versions, we must use select() to count trailing nils.
8
- return __TS__IsLua50 ? args.length : select("#", ...args);
+ // select() is not available in Lua 5.0. In that version, the arg table
+ // includes trailing nils.
+ // It is important that the select() branch come first as we need vararg
9
+ // optimization for this call.
10
+ return !__TS__IsLua50 ? select("#", ...args) : args.length;
11
}
0 commit comments