mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 05:37:39 +03:00
util.helpers: Add get_upvalue(function, name) helper
This commit is contained in:
parent
fd9cf02217
commit
e442e6afe5
1 changed files with 9 additions and 0 deletions
|
@ -24,4 +24,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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue