[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Function pcall and 0..n return values
- From: Florian Berger <fberger@...>
- Date: Thu, 16 Oct 2003 10:51:11 +0300 (EET DST)
Hi.
I'm having following problem with function pcall. I'm using function pcall
with different functions that have their parameters (0..n) in a table. I
found unpack-function very practical for parameters. The problem is that
functions may also return 0..n return values. How could I code a general
case that saves return values of pcall-fucntion for example in a table? I
cannot use unpack-function for table as second return value because it
causes a syntax error.
Example for using unpack-function for parameters in a table:
function Test(a, b)
return a, b
end
local bStatus, a, b
local Param = {1, 2}
bStatus, a, b = pcall(Test, unpack(Param))
print(a, b)
Floru