lua-users home
lua-l archive

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


>Now to my question. I set a breakpoint on the print statement in the function 3
>and invoke 'Main'. 
>Then when the breakpoint is hit, I get the following output from my line hook
>
>Line hook: c:6, n:function3, w:global, u:0, d:5, w:Lua, s:(0:0) m:string "(0:0)"
>Line hook: c:2, n:function2, w:global, u:0, d:0, w:main, s:(0:0) m:string
>"(0:0)"
>Line hook: c:11, n:function1, w:global, u:0, d:9, w:Lua, s:(0:0) m:string
>"(0:0)"

I don't know what is wrong, but when the same thing is run from Lua it works:

I've changed function3 to:

function function3()
    print(" in function3")  --> breakpoint set here
    trace()
end

where

function trace()
 for i=1,1000 do 
  local a=getinfo(i)
  if a==nil then break end
  write(format("Line hook: c:%u, n:%s, w:%s, u:%u, d:%u, w:%s, s:%s m:%s\n",
  a.currentline, a.name or "nil", a.namewhat or "nil",
  a.nups, a.linedefined, a.what, a.source, a.short_src))
 end
end

Then I get

in function1
 in function2
 in function3
Line hook: c:3, n:trace, w:global, u:0, d:1, w:Lua, s:@j m:file `j'
Line hook: c:8, n:function3, w:global, u:0, d:6, w:Lua, s:@i m:file `i'
Line hook: c:3, n:function2, w:global, u:0, d:1, w:Lua, s:@i m:file `i'
Line hook: c:13, n:function1, w:global, u:0, d:11, w:Lua, s:@i m:file `i'
Line hook: c:18, n:Main, w:global, u:0, d:16, w:Lua, s:@i m:file `i'
Line hook: c:21, n:nil, w:, u:0, d:0, w:main, s:@i m:file `i'

which seems right.
--lhf