lua-users home
lua-l archive

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


On Wed, Feb 14, 2007 at 02:23:29PM -0400, Shea Martin wrote:
> 1.
> I am a little unclear on the difference between pushing a c-closure, and 
> a c function.

Pushing a C function is just a little wrapper that pushes a closure with
no upvalues.

> I realize that closure can access upvalues, but if no 
> upvalues are needed is there a difference?  Why would I want to use 
> upvalues instead of function parameters?

function parameters are "per function invocation", upvalues are attached
to the function, they are present every time the function was called.

See the standard library for examples of use, or Programming Lua has an
example that uses a directory iterator and upvalues, if I recall
correctly.

> 2.
> Does the lua vm distinguish b/n int/floats?

No.