tests/pass/vararg.lua

Mon, 22 Nov 2010 04:56:38 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 22 Nov 2010 04:56:38 +0000
changeset 126
07ec490c7a6f
permissions
-rw-r--r--

Add a whole bunch of tests I've been using for recent additions

function foo(a, b, ...)
	assert(a == 1);
	assert(b == 2);
	local c, d = ...;
	assert(c == 3);
	assert(d == 4);
	return a, b, ...;
end

local a, b, c, d = foo(1, 2, 3, 4);
assert(a == 1);
assert(b == 2);
print("c is", c);
assert(c == 3);
assert(d == 4);

mercurial