Diff

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
line wrap: on
line diff
--- a/util/debug.lua	Fri Oct 13 19:55:33 2017 +0200
+++ b/util/debug.lua	Sun Oct 15 11:42:33 2017 +0200
@@ -47,6 +47,7 @@
 		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