How to print a table

This is basic but how do you print a table where you can open and close it? It used to be like this but for whatever reason if I now try to print out a table it will just say table: [hex stuff]. - I don’t think I’ve changed any settings either

1 Like
local Table = {'hello', 'there'}

for i,v in pairs(Table) do
	print(v)
end

no yeah, it’s like that for me too, I’m not sure as to why roblox removed it. I have to use a function for it now.

function recursive(tbl)
 for i,v in pairs(tbl) do
  if typeof(v) == "table" then
   recursive(v)
  end
  print(i," | ",v)
 end
end
1 Like

just print the table:

print(table)

Or did Roblox change something?

I use this all the time. Just print the table simple easy awesome:

print(table)

It just prints this instead:

image

You can’t print a table, you need to loop through and print the contents. You can also do this:

local Table = {'hello', 'there'} print(table.concat(Table, ', '))

image

1 Like

Unless I can revert it back to the original, this would probably be the best bet, so thanks!

local Table = {}

print(Table)

This just prints table: hexcode instead

1 Like

This is most likely the location of the table inside of the computer.

local function printTableRecursive(t, c)
	c = c or {}
	if not c[t] then
		c[t] = true
		for i, v in pairs(t) do
			if type(i) == "table" then
				printTableRecursive(i, c)
			else
				print(i)
			end
			
			if type(v) == "table" then
				printTableRecursive(v, c)
			else
				print(v)
			end
		end
	end
end

Bare in mind this won’t be compatible with function/thread/userdata types.

2 Likes

Make sure log mode is turned off for your console:

image

6 Likes

Disable log mode to view an expandable table in your output widget, in all other cases you will use httpservice to encode and decode it.

2 Likes