mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
30 lines
446 B
Perl
30 lines
446 B
Perl
|
|
|
|
terra foo()
|
|
return 1,2
|
|
end
|
|
|
|
terra foo2()
|
|
return {a = 1, b = 2}
|
|
end
|
|
|
|
assert(unpacktuple(1) == 1)
|
|
assert(unpacktuple(foo()) == 1)
|
|
|
|
assert(unpacktuple(foo(),2) == 2)
|
|
|
|
assert(unpacktuple(foo(),nil,1) == 1)
|
|
assert(unpacktuple(foo2()).a == 1)
|
|
|
|
assert(2 == #{unpacktuple(foo())})
|
|
|
|
assert(1 == #{unpacktuple(foo(),2)})
|
|
|
|
terra usefoo()
|
|
var a = foo()
|
|
var c,d = unpacktuple(a)
|
|
var e = unpacktuple(a,2)
|
|
return e
|
|
end
|
|
|
|
assert(usefoo() == 2) |