Skip to content

Instantly share code, notes, and snippets.

@shuax
Created January 4, 2017 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuax/9f3c6da48240c5ea76f66975577884e0 to your computer and use it in GitHub Desktop.
Save shuax/9f3c6da48240c5ea76f66975577884e0 to your computer and use it in GitHub Desktop.
local function check_endless_loop()
local stat = {}
local function hook_line(e, line)
local source = debug.getinfo(2).source
if not stat[source] then
stat[source] = {}
end
if not stat[source][line] then
stat[source][line] = 0
end
stat[source][line] = stat[source][line] + 1
if stat[source][line] > 100000 then
stat[source][line] = 0
print("may endless loop", source, line)
end
end
debug.sethook(hook_line, "l")
print("start check endless loop")
end
check_endless_loop()
a = 1
for i=1,1000000 do
a = a + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment