lua-users home
lua-l archive

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


On Tue, May 18, 2010 at 9:12 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> But I see that lua_pushcfunction is just a macro for lua_pushcclosure:
>>    #define lua_pushcfunction(L,f)  lua_pushcclosure(L,f,0)
>>
>> and lua_pushcclosure(L,f,0) creates a light C function, so I guess Lua
>> callbacks from light C functions are allowed. Is this so?
>
> Yes. Light C functions are exactly like current C functions except that they
> don't have upvalues. It's an implementation optimization and one that has
> shown to save a good amount of memory. Moreover, light C functions can be
> sent to Lua without fearing memory allocation errors.
>


Excellent. So, presumably, that means...


Lua 5.2.0 (work2)  Copyright (C) 1994-2010 Lua.org, PUC-Rio
> =pairs({}) == next
false
>


Lua 5.2.0 (work3)  Copyright (C) 1994-2010 Lua.org, PUC-Rio
> =pairs({}) == next
true
>


...Cool. :)

 (Maybe only to me, though...)

-Duncan