Why does my table come out in a table: lh123loffg423123 way?

cant i just print the way I mentioned above? cause writing a loops takes some time ;-;

no + it takes 0 time

in the time you took to do this post you couldve wrote 50

this post took me 1 minute and writing that takes me 2 and thats the WORST metaphor i have ever seen ;-; (no offense)

that’s not even a metaphor :skull:
[limit]

for Index, Current in ipairs(Table) do
    print(tostring(Current))
end

Took me 10 seconds, enjoy! :slightly_smiling_face:

1 Like

I sympathize with you because this can be annoying, especially for new scripters. I think print should ideally print out both the hex and unwrap the content for you. Once you become more experienced it will seem more natural and you’ll hardly be printing out tables anyways.

thats kinda try tbh i am kinda used to it but still! roblox should remove this (i know now that its more of a “FEATURE”) roblox is kinda getting worse then ever

i dont see why roblox should cater for the utter lazy but ok

i agree with making things easy but come on

Listen printing tables unwrapped help in organzing like heres a example for ya

what loops print (table in table)

table: bla bla bla
table: bla bla bla2
table: bla bla bla3
table: bla bla bla4

what unwrapped prints

table = {
Item = {},
Item2 = {},
Item3 = {},
Item4 = {}
}

see the difference? unwrapped one is MORE organized

print("table = {")
for i, v in pairs(table) do
print(v..",")
end
print("}")

you could even make a function that takes a table argument and does this for you.
though for dictionaries I am aware it automatically wraps anyway

yes i know i thought og that wayy before! but AGAIN it does not print the table as expected anyways on with the topic!

disable log mode on the output if you dont want it to display the memory address of tables

8 Likes

There are options for the output window that you can modify. You can enable the feature that allows you to open a table in the output window, you can also enable it so that tables open automatically in the output when printed.

As the post above mentioned, you must first disable log mode.

In addition to this if the table is an array you can also do the following.

local tables = {"a", "b", "c"}
print(table.concat(tables, " ")) --a b c

The table library function table.concat() returns a string value concatenation of an arrays’ entries. The first argument should be the table value itself, the second argument represents the concatenation separator/delimiter which determines how each concatenated item should be split.

1 Like

hmm ill see your and @SquarePapyrus12 if to no avail ill do what @Forummer says
Also sorry for a very late response i was sleeping…

P.S Sorry for pings i dont usually do ping

Anybody want to petition Roblox to make a printtable function as part of the normal set of functions?

1 Like

Dont think anyone would want that at all

Here’s a recursive print table function:

function printt(table, tab)
  tab = tab or ''
  for i,v in pairs(table) do
    if type(v)=="table" then
      print(tab.."'"..tostring(i).."'".." = {")
      printt(v, tab.."\t")
      print(tab.."};")
    else
      print(tab.."'"..tostring(i).."' = "..tostring(v))
    end
  end
end

Quite honestly this recursive table print is very simplistic. I was hoping for a universal table print. Perhaps even better just make a table to text function so you can print the resulting text so it would appear as one print in studio and give more printing flexibility.

local http = game:GetService("HttpService")

local function printDictionary(dict)
	local success, result = pcall(function()
		return http:JSONEncode(dict)
	end)
	
	if success then
		if result then
			print(result)
		end
	else
		warn(result)
	end
end

printDictionary({["a"] = 1, ["b"] = 2, ["c"] = 3})

That’d be the purpose of JSONEncode().

the topic has been solved doe lol