function ( a, b, ... )
a = select(5, ...); -- 可変引数 5 番目取得.
end
string.format
function test(...)
local arr = {...};
for i=1, #arr do
print( arr[i] );
end
end
do
test( "a", "b", "c", 10 );
end
function fnMyUpper( s )
local l = string.len( s );
local str = string.upper( s );
return l, str;
end
do
local len, s;
len, s = fnMyUpper( "aiueo" );
print( len.."\t"..s);
end
a = {}
a[1] = { name="a", price=300 };
a[2] = { name="b", price=100 };
a[3] = { name="c", price=200 };
table.sort( a, function ( a, b ) return a.price > b.price end );
for i=1, #a do
print( a[i].price );
end