[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: source for functions
- From: Steve Dekorte <steve@...>
- Date: Thu, 11 Dec 97 16:26:41 -0800
>>Is there any way to ask Lua for the source code of a function?
>no. don't you mean bytecodes instead of source?
Nope (explained below)
>>If not, what's the best way to add this feature?
>depends. why do you need this?
I'm writing a Lua object browser. When I click on an Object and then select
a slot that holds a function, I want it to be able to bring up the source
code for it.
>>This is an important feature for a dynamic system like Lua because you
>>never now if your external source matches what's in the system.
>you lost me here. can you give an example?
For example, in the case of my object browser -
Let's say it browsed my source code instead of Lua. This would not
always reflect what was in Lua since I can change/add/remove
attributes and methods at runtime. So the only reasonable approach
is to look directly at the system, not the source. And I can do
that for everything (tables, attributes) with the exception of functions.
>This would also allow Lua to be able to save an image of the system from
>withing Lua.
>
>i'm actually working on this but it's hard (because of cycles in data
>structures and such). and we'd like it to be general.
>if you only want to save bytecodes, then it's easy and most of what is needed
>is already available in luac.
I think adding the ability to get the source for a function at runtime
might be a required step no matter which way imaging is implemented.
Steve Dekorte