Created
January 4, 2017 02:12
-
-
Save shuax/9f3c6da48240c5ea76f66975577884e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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