Prevent error loops in xpcall.

This commit is contained in:
Florian Nücke 2014-06-28 18:52:11 +02:00
parent c4986eeb82
commit 009e51b288

View File

@ -99,8 +99,16 @@ sandbox = {
tostring = tostring, tostring = tostring,
type = type, type = type,
_VERSION = "Lua 5.2", _VERSION = "Lua 5.2",
xpcall = function(...) xpcall = function(f, msgh, ...)
local result = table.pack(xpcall(...)) local handled = false
local result = table.pack(xpcall(f, function(...)
if handled then
return ...
else
handled = true
return msgh(...)
end
end, ...))
checkDeadline() checkDeadline()
return table.unpack(result, 1, result.n) return table.unpack(result, 1, result.n)
end, end,