-- Checks whether a table has an object "value" in it
function contains(table, value)
- for k,v in pairs(table) do
+ for k, v in pairs(table) do
if value == v then
- return true
+ return k
end
end
return false
offset = offset + size + subint(dump, offset, size)
elseif t == 3 then
offset = offset + num
- elseif t == 254 then
+ elseif t == 254 or t == 9 then
offset = offset + lnum
end
end
local c = coroutine.running()
local thread = coxpt[c] or c or 0
if not rawget(self, thread) then
- rawset(self, thread, {})
+ return nil
end
return rawget(self, thread)[key]
end
rawget(self, thread)[key] = value
end
- setmetatable(tbl, {__index = get, __newindex = set})
+ setmetatable(tbl, {__index = get, __newindex = set, __mode = "k"})
return tbl
end
local performResume, handleReturnValue
local oldpcall, oldxpcall = pcall, xpcall
coxpt = {}
+setmetatable(coxpt, {__mode = "kv"})
function handleReturnValue(err, co, status, ...)
if not status then
end
local c = coroutine.running()
coxpt[co] = coxpt[c] or c or 0
+
return performResume(err, co, ...)
end