Hello!
I just had a question the thing in the title, is this just a placeholder for the cyclic table reference or is the string the actual value of it?
Hello!
I just had a question the thing in the title, is this just a placeholder for the cyclic table reference or is the string the actual value of it?
The reference of a cyclic table is similar to this:
a = {}
a[1] = a
It seems rather close to the error of “tables cannot be cyclic”.
Yeah but is a[1]'s value actually a or is it the string “*** cycle table reference detected ***”?
I still don’t understand the context, there are no string values involved.
local a = {} a[1] = a print(a[1])
Hmm, that’s new. I think they intentionally swapped the cyclic reference with the string.
Right but if I were to do something like this
local a = {}
a.b = {}
a.b.Parent = a
then try to reference a.b.Parent, would that cause any issues?
Tables are not Instance
s, they do not have parents or children. They’re more rudimentary. However, if you meant that:
a = {}
a.b = {}
a.b.c = a
Same thing would happen.
I know. I’m creating a custom property inside of the table called parent. I’m asking if this cyclic reference would cause any issues (like if the value was the string “***cycle table reference detected***” or if that string is just a placeholder)
They would actually cause issues if you were trying to create cyclic tables, because the programming doesn’t quite allow you to do that. You cannot serialize the cyclic tables. The string might have been a placeholder whenever you print that.
Alright, any ideas how Roblox did their parent system then? Every instance is fundamentally a table.
They are not using a cyclic method, they are apparently using inheritance and that programming is on C++ which I find it quite messy to read already. Fundamentally, it’s not always just a table, it’s something else.
On another note, I am not quite certain that it is cyclic? I think the only issue are only apparent t when it comes to serialization of the tables, meaning no storage. You can probably still operate the table as per usual even if it was cyclic.
I could finally confirm that cyclic tables can only be operated but not stored:
a = {d = "HAHAHA"}
a.b = {}
a.b.c = a
print(a.b.c.d) -- HAHAHA
Yeah, I think it works fine.
This works as normal:
local a = {} a.b = {} a.b.Parent = a print(a.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent.b.Parent)
Just remember to not store or serialize the table. It would be a disaster, ahahaha.