LRDB icon indicating copy to clipboard operation
LRDB copied to clipboard

Add view support for tables with table keys

Open robinvierich opened this issue 6 years ago • 3 comments

When a table is keyed by other tables, LRDB erroneously reports that the table is empty.

Using "next" on these tables returns JSON and is not parsed into an inspectable lua table.

A simple repro case:

a = {}
b = {}
b[a] = 1

b will be displayed as empty in this case

robinvierich avatar Aug 08 '18 21:08 robinvierich

Hate to resurrect a year old issue but I've just run into this, and it seems to be the case for all non-string table keys.

https://github.com/satoren/LRDB/blob/68378984d689e7ca36b56a7c625bb5a6e3d318ba/include/lrdb/debugger.hpp#L102-L107

Unfortunately this repo looks a little dead but finding a solution to this seems doable. not mapping lua tables 1:1 to json may be a decent start :p

manpat avatar Sep 03 '19 13:09 manpat

If you allow for hide by key string duplicates, remove if (lua_type(L, -2) == LUA_TSTRING) and use luaL_tolstring for key.

satoren avatar Sep 04 '19 02:09 satoren

I think this is a good temporary fix, but it's not really ideal. For table keys that might be fine, but for things like numbers, you probably want to keep that type information somehow. I recognise that might not fit under the scope of this issue though

manpat avatar Sep 04 '19 10:09 manpat