lua-users home
lua-l archive

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


	if (dumping) luaU_optchunk(tf);

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Luiz Henrique
de Figueiredo
Sent: 12 August 2003 13:39
To: lua@bazar2.conectiva.com.br
Subject: Re: How do you do this in C?


>The key point being that it instantiates a closure that references 
>itself.
>
>How would I do this in C? (C is interesting because it can avoid the 
>whole pack/unpack the arguments step.) Closures take values on the 
>stack, but at the point when I'm creating the closure it doesn't exist 
>as a value to put on the stack.

Use an upvalue instead, with value nil when the closure is created and
set it to the correct Lua value after the closure is created with
lua_setupvalue. 
--lhf