[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Getting a reference to the current function
- From: "Gavin Kistner" <gavin.kistner@...>
- Date: Wed, 4 Oct 2006 11:47:11 -0600
Is there a way in Lua to get a reference to the currently-running
function without using the debug library? (I want the equivalent of
"debug.getinfo(1).func") In JavaScript, this property is always
available as "arguments.callee".
The reason I'm asking is I want a way to associate some userdata objects
with a function so that the function always has access to them. In
JavaScript, I'm doing this like:
function foo( ) {
var theTempVector = arguments.callee.v1;
// ...
}
foo.v1 = new Vector;