Skip to content
Browse files

Merge pull request #23 from norman/get_set_env_fixes

(g|s)etfenv fixes
  • Loading branch information...
2 parents 3831845 + 664888d commit 27bb915141249cd72e3151e2559de71d33eb4119 @stevedonovan committed Apr 10, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 lua/pl/utils.lua
View
2 lua/pl/utils.lua
@@ -230,9 +230,11 @@ else
debug.upvaluejoin(f, up, function() return name end, 1) -- use unique upvalue
debug.setupvalue(f, up, t)
end
+ if f ~= 0 then return f end
end
function getfenv(f)
+ local f = f or 0
f = (type(f) == 'function' and f or debug.getinfo(f + 1, 'f').func)
local name, val
local up = 0

0 comments on commit 27bb915

Please sign in to comment.
Something went wrong with that request. Please try again.