lua-users home
lua-l archive

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


> My implementation of breakpoints is as follows: a table in the registry
> contains strings of lua code of the form "return exp" indexed by the
> breakpoint's location stored as a string. [...], but this does not work
> with conditions relating to local variables.

Another option is to precompile your breakpoint code inside a function,
and declare the locals as paramenters to the function. Something like
this:

   local pre = {p=nil}
   function-to-be-called-at-line-2 ()
     if %pre.p == nil then    -- first time?    
       local s = collect_local_names_list()
       %pre.p = dostring("return function ("..s..") return "..exp.." end")
     end
     local v = collect_local_values_list()
     if call(%pre.p, v) then ...
  end

-- Roberto