util.debug: Produce a sensible name for nameless upvalues to C functions

This commit is contained in:
Kim Alvefur 2017-10-15 11:42:33 +02:00
parent 9f3c47fb9f
commit 2855a2ce0a

View file

@ -47,6 +47,7 @@ local function get_upvalues_table(func)
for upvalue_num = 1, math.huge do
local name, value = debug.getupvalue(func, upvalue_num);
if not name then break; end
if name == "" then name = ("[%d]"):format(upvalue_num); end
table.insert(upvalues, { name = name, value = value });
end
end