printTable is not Lua or JSON so cannot be easily reused

  • printTable(mytable)

Output:

{
	{
		[x] = 274.0,
		[y] = 74.0,
	},
	{
		[x] = 273.0,
		[y] = 73.0,
	},
}

This seems to be neither Lua, nor JSON.

If I remove the [ and ] brackets it will pass as Lua.

I think the output should be Lua so it can be easily reused.

3 Likes

I agree, we should improve this. Thanks!

3 Likes

I came to report the same thing. Funnily enough, I do not have the exact same output (I am 1.12.3). I am not getting the table enclosure and the "separation" comma is after each final element of the table.

{
	120,
	84,
}
{
	267,
	132,
}

EDIT: To provide some context on the use case. I originally wanted to run a function real time but it was way too slow so I am just outputing the computation so I can reuse it in a "static" way.

1 Like

This caught me out again. :crazy_face:

The easy fix is to (as of SDK 2.0.0) change line 204 of CoreLibs/object.lua

from:

key = '['..tostring(k)..'] = '

to:

key = tostring(k)..' = '