Commits

Chris Klimas committed 61bc543

Better display of non-Lua functions in stack

Comments (0)

Files changed (1)

zoetrope/debug/stack.lua

 			info = debug.getinfo(level, 'nlS')
 			
 			if info then
-				if info.name then
-					self.text.text = self.text.text .. info.name .. '()\n    '
+				self.contentHeight = self.contentHeight + self.lineHeight
+
+				if info.name and info.name ~= '' then
+					self.text.text = self.text.text .. info.name .. '()\n'
+				elseif not info.name then
+					self.text.text = self.text.text .. '(anonymous function)\n'
+				else
+					self.text.text = self.text.text .. '(tail call)\n'
+				end
+
+				if info.currentline ~= -1 then
+					self.text.text = self.text.text .. '    ' .. info.short_src ..
+					                 ':' .. info.currentline .. '\n'
+
 					self.contentHeight = self.contentHeight + self.lineHeight
 				end
-
-				self.text.text = self.text.text .. info.short_src .. ':' .. info.currentline .. '\n'
-				self.contentHeight = self.contentHeight + self.lineHeight
 			end
 
 			level = level + 1