mod_adhoc: Add support for commands only executable by global administrators
[prosody.git] / util / helpers.lua
index c84347946e92aefb3b74414c7050148c2ca4e90f..1135617606210d4419d1567dd9e10ea65d1a640a 100644 (file)
@@ -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;