|
D Burgess wrote:
I do not know whether is normal, but it happens. It is not just your C++ function.print(gcinfo())21 29print(gcinfo(),1)22 1print(1,gcinfo())1 22 29 regards DB Gil Damoiseaux <gil@neurotv.be> wrote: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
From the manual (2.5.7 - Function Calls):Because a function can return any number of results (see 2.4.4), the number of results must be adjusted before they are used. If the function is called as a statement (see 2.4.6), then its return list is adjusted to zero elements, thus discarding all returned values. If the function is called inside another expression or in the middle of a list of expressions, then its return list is adjusted to one element, thus discarding all returned values except the first one. If the function is called as the last element of a list of expressions, then no adjustment is made (unless the call is enclosed in parentheses).
Looks like your problem... -- --=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=-- Philippe Lhoste (Paris -- France) Professional programmer and amateur artist http://jove.prohosting.com/~philho/ (outdated) http://phi.lho.free.fr (in French, for files to download) --=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--