/* Search for a name for a function in all loaded and ROM modules  */
static int pushglobalfuncname(lua_State *L, lua_Debug *ar)
/* Search for a name for a function in all loaded and ROM modules  */
static int pushglobalfuncname(lua_State *L, lua_Debug *ar)
{
    lua_settop(L, top+1);
    lua_getglobal(L, "ROM");
    if (!findfield(L, top + 1, 2)) {
      lua_settop(L, top);
      return 0;
    }
  }
  const char *name = lua_tostring(L, -1);
  if (strncmp(name, "_G.", 3) == 0) {
    lua_pushstring(L, name + 3);
    lua_remove(L, -2);
  }
  lua_copy(L, -1, top + 1);
  lua_pop(L, 2);
  return 1;
}