lua-users home
lua-l archive

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


I'm curious why a line number hook is never called for the anonymous
functions embedded inside the coroutines in the code snippet below.
Lua doesn't report the body of the function as being active, which
seems counter intuitive to me.  Clearly the code is going to be
called.  What is the justification for this design?


local code = [[
	local co = coroutine
	local ff = co.wrap(function()
		for i=1, 3 do
			print("i: ", i)
			co.yield()
		end
	end)
	
	ff()
	ff()
	ff()
	ff()
]]

For active lines numbers, I get:

1	'true'
2	'true'
11	'true'
7	'true'
10	'true'
12	'true'
9	'true'