lua-users home
lua-l archive

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


On Sat, May 14, 2011 at 8:10 AM, Benoit Germain <bnt.germain@gmail.com> wrote:
> local old_dofile = dofile
> dofile = function( ...)
>  track_node( ...)
>  return old_dofile( ...)
> end

> Since 'dofile' is a global identifier, any code that references it
> should call yours instead.

The problem with that approach for my use case is that I can't control
what code the users write. I need a method that analyzes what they
write rather than executing it. The dofile analogy would be that
nothing is known about the script being analyzed other than the
possibility that it contains one or more dofile lines and that the
files pointed to by those lines may also contain one or more dofile
lines, and so on ad infinitum.

In my case it's do-node lines rather than dofile lines, but the
problem is analogous. I can't force users to include particular code
in their scripts.

I think I've come up with a solution that I'll sketch in response to
Steve post.

Thanks for taking the time to think about my problem. I appreciate it.

Best regards,

Paul

NoteCase Pro
The Massively Multi-Platform Outliner
<http://notecasepro.com/>