Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Koneki » Debugging watch window where __type has been set
Debugging watch window where __type has been set [message #898682] Fri, 27 July 2012 04:10 Go to previous message
Richard Geary is currently offline Richard Geary
Messages: 7
Registered: July 2012
Junior Member
I'm trying to debug some 3rd party Lua code, where they have set the __type metafield for a table. The Koneki debugger's watch window shows this value as "table: 0xc40520", rather than table[10], and I lose the ability to see what's inside the table.

Can I fix this so the watch window looks at the builtin type to decide how to display it? Where in the codebase would I look?

Thanks!

Update :

The 3rd party code is overriding the built-in type function to retrieve the __type metadata field, so the problem is just the debug watch window doesn't handle it well.
--
-- An extension to type() to identify project object types by reading the
-- "__type" field from the metatable.
--
	local builtin_type = type	
	function type(t)
		local mt = getmetatable(t)
		if (mt) then
			if (mt.__type) then
				return mt.__type
			end
		end
		return builtin_type(t)
	end


To repro, add the above plus :
local obj = {}
obj.x = 2
setmetatable( obj, { __type="blah" })
-- Set a breakpoint here, obj is table : 0xsomething in watch window
local typeofObj = type(obj)  
-- But typeofObj is correctly "blah" in watch window

[Updated on: Mon, 30 July 2012 04:18]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Setting up for the first time
Next Topic:Debugging Lua code launched from a Lua program
Goto Forum:
  


Current Time: Fri May 24 22:21:14 EDT 2013

Powered by FUDForum. Page generated in 0.01643 seconds