X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fhelpers.lua;h=e69f1d98c3540032d7bcca9bb8cd77c01ada1a9b;hb=0cb336947c50bf6def4d40ac541f37ef6359d27b;hp=c84347946e92aefb3b74414c7050148c2ca4e90f;hpb=de6b4e88279f7e0bbb3cdfdc38bf8801a9582102;p=prosody.git diff --git a/util/helpers.lua b/util/helpers.lua index c8434794..e69f1d98 100644 --- a/util/helpers.lua +++ b/util/helpers.lua @@ -1,3 +1,10 @@ +-- Prosody IM +-- Copyright (C) 2008-2009 Matthew Wild +-- Copyright (C) 2008-2009 Waqas Hussain +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- module("helpers", package.seeall); @@ -24,4 +31,13 @@ function revert_log_events(events) events.fire_event, events[events.fire_event] = events[events.fire_event], nil; -- :) end +function get_upvalue(f, get_name) + local i, name, value = 0; + repeat + i = i + 1; + name, value = debug.getupvalue(f, i); + until name == get_name or name == nil; + return value; +end + return _M;