lua-users home
lua-l archive

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

On May 18, 2010, at 1:12 PM, Luiz Henrique de Figueiredo 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.

Bravo. I've wanted those for a while -- in particular for the last issue -- though the revisions to lua_cpcall seemed to make it less critical.