[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Controlling execution
- From: Michael Roth <mroth@...>
- Date: Fri, 24 Sep 2004 10:23:05 +0200
Florian Berger wrote:
Ok. What I want to control at this point are variable assignments
(global and local) and function calls. With function calls I mean
function's parameters and return values. So I want to have control over
parameters before function is called and return values before they are
At least for global functions and variables, you could implement this in
For your chunk of code to be executed, set a private environment
(setfenv) with a metatable containing __index and __newindex functions.
Inside these functions you could catch the assigment and retrieval of
global variables. For the case there is a retrieval of a function
(because a function call is to be made), you could return a proxy
function (a closure) which checks the arguments if it gets called and
call the real function after the checks.
You can't trace local variables with this approach.
Description: OpenPGP digital signature