Software /
code /
prosody
Comparison
util/debug.lua @ 8322:cd15fc505b62
util.debug: Produce a sensible name for nameless upvalues to C functions
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 15 Oct 2017 11:42:33 +0200 |
parent | 7182:858ccafbd823 |
child | 8382:e5d00bf4a4d5 |
comparison
equal
deleted
inserted
replaced
8321:73ff49a42ea8 | 8322:cd15fc505b62 |
---|---|
45 local upvalues = {}; | 45 local upvalues = {}; |
46 if func then | 46 if func then |
47 for upvalue_num = 1, math.huge do | 47 for upvalue_num = 1, math.huge do |
48 local name, value = debug.getupvalue(func, upvalue_num); | 48 local name, value = debug.getupvalue(func, upvalue_num); |
49 if not name then break; end | 49 if not name then break; end |
50 if name == "" then name = ("[%d]"):format(upvalue_num); end | |
50 table.insert(upvalues, { name = name, value = value }); | 51 table.insert(upvalues, { name = name, value = value }); |
51 end | 52 end |
52 end | 53 end |
53 return upvalues; | 54 return upvalues; |
54 end | 55 end |