Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make getfenv more closely match 5.1's behavior

According to "The
default for f is 1" so when there is no argument passed, we should be
passing 1 into debug.getinfo. Without this, Lua complains about the
"attempt to perform arithmetic on local 'f' (a nil value)".  Hence f
should be initialized to 0 when no argument is passed.
  • Loading branch information...
commit 664888dd4c780d7147868ae7e342c297960a0aa3 1 parent 60996ff
@norman norman authored
Showing with 1 addition and 0 deletions.
  1. +1 −0  lua/pl/utils.lua
1  lua/pl/utils.lua
@@ -234,6 +234,7 @@ else
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
Please sign in to comment.
Something went wrong with that request. Please try again.