Search code examples
luahooklua-5.2c++builder-xe3

How to tell if a Lua line number is a valid execution point (from C/C++)?


How Can I tell if line number x in a Lua script will respond to the Lua line hook?

Example:

 1 first = 1
 2 
 3 function test ( data )
 4  if first == 0 then
 5    print ("\r\n")
 6  end
 7  print(data)
 8  --[[
 9  first = 0
10  ]]
11 end
12
13 test()
14

Line 2,6,8,9,10,12 and 14 does not call a line hook. After I have loaded and executed the script, can I some how, from C/C++, get a table of the executable line numbers?


Solution

  • lua_getinfo can return a table of valid lines if you include L in what.