Here’s a simple program that doesn’t error, but also doesn’t necessarily work.
local a = {}
a[1] = a
print(game:GetService("HttpService"):JSONEncode(a))
It outputs ["*** certain entries belong to the same table ***"]
If there are multiple instances of such a problem then it will repeat this message. If I add a[2] = a
then the output becomes ["*** certain entries belong to the same table ***","*** certain entries belong to the same table ***"]
Here’s a longer program that completely crashes studio because it tries to generate a string that’s millions of characters long.
local t = {}
for y = 1, 7 do
t[y] = {}
for x = 1, 7 do
t[y][x] = {}
end
end
for y = 1, 6 do
for x = 1, 6 do
table.insert(t[y][x], t[y+1][x])
table.insert(t[y][x], t[y][x+1])
table.insert(t[y+1][x], t[y][x])
table.insert(t[y][x+1], t[y][x])
end
end
game:GetService("HttpService"):JSONEncode(t)
If you were to try to pass such a table through a remote, it will cause a crash and not error. It would make more sense if it errored.