Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I print this whole thing into one line?

I tried the unpack() function and table.concat but none of these actually gave me what I wanted, instead it printed nothing. Here is what I want to convert into a string. My idea is if I looped through the dictionary and then printing the contents but it didn't put all of it in one line. I want to print the contents of "Wall" into one line.

local thing = {
	["Wall"] = {
		["Wood"] = 1, ["Stone"] = 100;
	};

}

1 answer

✓ Accepted answer

Hello,

You can try using JSONEncode which is a function of HttpService.

local HttpService = game:GetService("HttpService")

local thing = {

	["Wall"] = {
		["Wood"] = 1, ["Stone"] = 100;
	};
}

print(HttpService:JSONEncode(thing.Wall))

The output would look something like this: {"Stone":100,"Wood":1}.

Hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.