lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It is normal. When a function returns multiple values they will be printed out only if this function was the last to be called.

Example:

function f() return 1, 2, 3 end
print(0, f())
-> 0, 1, 2, 3
print(f(), 4)
-> 1, 4

Milano

From: "Gil Damoiseaux" <gil@neurotv.be>
Reply-To: Lua list <lua@bazar2.conectiva.com.br>
To: <lua@bazar2.conectiva.com.br>
Subject: Wrong number of elements in stack ...
Date: Fri, 7 May 2004 13:44:09 +0200

Hi,

	I'm using Lua since some months now, and I've come across a problem today
that I've never noticed. I have a C++ function that returns 3 integers, let
says a GetPosition() that return x,y and z.

when I do:
	print(GetPosition())
I have :
	12   34   55

But when I do
	print(GetPosition(),99)
I have:
	12   99

	Is this really normal? Or did I miss something?

Thanks in advance,

Gil Damoiseaux, ITV engineer, www.neurotv.be



_________________________________________________________________
MSN Hotmail, o maior webmail do Brasil.  http://www.hotmail.com