X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fhelpers.lua;h=1135617606210d4419d1567dd9e10ea65d1a640a;hb=0ef23c673d1d620c9c1cc3e8aed43add63634426;hp=c84347946e92aefb3b74414c7050148c2ca4e90f;hpb=b5f0f95a5aecced1bc3d5977c9ff934c42954d65;p=prosody.git diff --git a/util/helpers.lua b/util/helpers.lua index c8434794..11356176 100644 --- a/util/helpers.lua +++ b/util/helpers.lua @@ -1,3 +1,10 @@ +-- Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 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;