lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

E. Wing wrote:
> Since these were only triggered on error conditions, debug.getinfo
> would only be called in limited situations (basically for the exact
> purpose of debugging) so performance was not an issue.

To get the Lua 5.0 behaviour use this:

  local function findglobal(f)
    for k,v in pairs(_G) do
      if v == f then return k end

  local info = debug.getinfo(level, "nSlf")
  local name = or findglobal(info.func)