[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How do you do this in C?
- From: Mark Hamburg <mhamburg@...>
- Date: Mon, 11 Aug 2003 23:33:31 -0700
I have the following Lua code:
function makeMessage()
local f;
f = function( target, ... )
send( target, f, unpack( arg ) )
end;
return f
end
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.
Thanks.
Mark