lua-users home
lua-l archive

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


Not that it's much helpful, but this does not crash with luajit (with/without -joff, and on 32-bit/64-bit windows)

It also crashes with cygwin's lua (5.1.4) that I have installed.

On 4/20/2012 10:54 AM, Dan Tull wrote:
local function caller()
	local result, message = loadstring( "return" )
	return result, message
end

local function locals()
	local i = 1
	local inf, n, v
	
	repeat
		inf = debug.getinfo( i, "fn" )
		if inf and inf.func == caller then
			break
		end
		i = i + 1
	until not inf

	if inf then
		local j = 1
		repeat
			n, v  = debug.getlocal( i, j )
			if n then
				if type( v ) == "proto" and tostring( v ) then
					print "BOOM" -- never printed on 5.1.5
				end
			end
			j = j + 1
		until not n
	end
end

debug.sethook( locals, "", 1 )
caller()