lua-users home
lua-l archive

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


Note the parenthesise around the call to dn.gas - these truncate the
return values to a single value. Also be aware that a tail call does
not occur when calling a C function; the calling function remains on
the stack as the C function executes.

On 01/02/2008, Al Pfalzgraf <alpfalzgraf@hotmail.com> wrote:
>
> I have a library function that has a variable number of return values.  It
> uses a Lua interface function to format its arguments and pass back the
> return values from the library function.  The intent was to use the tail
> call behavior to move the library function's returned values back to the Lua
> script that calls the Lua interface function.
>
>  -- Get Attribute Single interface function for dn.gas library function
> function gas( className, InstanceId, attrName, comment )
>  return(dn.gas(  className, Node[className]["id"],
>    InstanceId,
>    attrName, Node[className][InstanceId][attrName]["id"],
>    Node[className][InstanceId][attrName]["type"],
>    comment )
>   )
> end
>
>  The difficulty I am having is in the return values.  By stepping through
> the library function it is known that two values are put on the stack to be
> returned, and the library function returns the value 2.  When the returned
> values from the interface function are displayed the first is correct but
> the second is a nil value.
>
>  Should this work or is there a better technique to use?
>
>  Thanks,
>  Al
>
> ________________________________
> Connect and share in new ways with Windows Live. Get it now!