lua-users home
lua-l archive

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


> 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.