Software /
code /
prosody
Comparison
util/helpers.lua @ 1959:f56670ce64de
util.helpers: Add get_upvalue(function, name) helper
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Oct 2009 22:03:32 +0100 |
parent | 1795:0e933d6f2c31 |
child | 1964:101a8df23b29 |
comparison
equal
deleted
inserted
replaced
1958:e2b0026143c4 | 1959:f56670ce64de |
---|---|
22 | 22 |
23 function revert_log_events(events) | 23 function revert_log_events(events) |
24 events.fire_event, events[events.fire_event] = events[events.fire_event], nil; -- :) | 24 events.fire_event, events[events.fire_event] = events[events.fire_event], nil; -- :) |
25 end | 25 end |
26 | 26 |
27 function get_upvalue(f, get_name) | |
28 local i, name, value = 0; | |
29 repeat | |
30 i = i + 1; | |
31 name, value = debug.getupvalue(f, i); | |
32 until name == get_name or name == nil; | |
33 return value; | |
34 end | |
35 | |
27 return _M; | 36 return _M; |