aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Janda <siffiejoe@gmx.net>2015-04-20 13:50:18 +0200
committerPhilipp Janda <siffiejoe@gmx.net>2015-04-20 13:50:18 +0200
commitaef3f24e32f6c50473b957c7fdd5ad707b543995 (patch)
tree13dc191a1efeb9749c7d34c175680cb02b6bf273
parenta4bdca7201500538835baefb81e193f8134989d2 (diff)
parenta7d337f0d1ccfde974a003993387a42b2daabfed (diff)
downloadlua-compat-5.3-aef3f24e32f6c50473b957c7fdd5ad707b543995.tar.gz
lua-compat-5.3-aef3f24e32f6c50473b957c7fdd5ad707b543995.tar.bz2
lua-compat-5.3-aef3f24e32f6c50473b957c7fdd5ad707b543995.zip
Merge branch 'master' into isolated
Conflicts: compat53/base.lua
-rw-r--r--compat53/base.lua25
1 files changed, 18 insertions, 7 deletions
diff --git a/compat53/base.lua b/compat53/base.lua
index 370909a..8fbc71f 100644
--- a/compat53/base.lua
+++ b/compat53/base.lua
@@ -378,12 +378,21 @@ if lua_version < "5.3" then
378 M.package = setmetatable({}, { __index = package }) 378 M.package = setmetatable({}, { __index = package })
379 379
380 380
381 -- table that maps each running coroutine to the coroutine that resumed it 381 -- the (x)pcall implementations start a new coroutine internally
382 -- this is used to build complete tracebacks when "coroutine-friendly" pcall 382 -- to allow yielding even in Lua 5.1. to allow for accurate
383 -- is used. 383 -- stack traces we keep track of the nested coroutine activations
384 local pcall_previous = {} 384 -- in the weak tables below:
385 local pcall_callOf = {} 385 local weak_meta = { __mode = "kv" }
386 local xpcall_running = {} 386 -- table that maps each running coroutine started by pcall to
387 -- the coroutine that resumed it (user coroutine *or* pcall
388 -- coroutine!)
389 local pcall_previous = setmetatable({}, weak_meta)
390 -- reverse of `pcall_mainOf`. maps a user coroutine to the
391 -- currently active pcall coroutine started within it
392 local pcall_callOf = setmetatable({}, weak_meta)
393 -- similar to `pcall_mainOf` but is used only while executing
394 -- the error handler of xpcall (thus no nesting is necessary!)
395 local xpcall_running = setmetatable({}, weak_meta)
387 396
388 -- handle debug functions 397 -- handle debug functions
389 if type(debug) == "table" then 398 if type(debug) == "table" then
@@ -660,7 +669,9 @@ if lua_version < "5.3" then
660 return result 669 return result
661 end 670 end
662 671
663 local pcall_mainOf = {} 672 -- maps the internal pcall coroutines to the user coroutine that
673 -- *should* be running if pcall didn't use coroutines internally
674 local pcall_mainOf = setmetatable({}, weak_meta)
664 675
665 if not is_luajit52 then 676 if not is_luajit52 then
666 function M.coroutine.running() 677 function M.coroutine.running()