Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created January 4, 2011 20:20
Show Gist options
  • Select an option

  • Save probablycorey/765346 to your computer and use it in GitHub Desktop.

Select an option

Save probablycorey/765346 to your computer and use it in GitHub Desktop.
function runString_debug(s, d)
local u,v=loadstring(s)
if (v~=nil) then
print(v)
else
-- Set up a debug hook.
if d==1 then
local function callb()
print("called callb")
error()
end
debug.sethook(callb,"l")
end
print "DOES THE CODE EVER GET HERE?"
local status, err=pcall(u)
print(status)
print(err)
end
end
runString_debug("for i=1,10 do print(i) end", 1)
print "DOES IT GET HERE?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment