When is table becoming cyclic? I always get an error (screenshot)
I'll explain as short as possible:
I wanted to create a game using oop. So:
in my game is going on:
-
When player joins the game the server makes a SELF for that player and also the local side of player makes a SELF.
-
Server sends a remote event to local side of player with the SELF properties (and because you can't pass metatables it returns just a table with all of its properties) to achieve the synchronization of player and server (because roblox does not provide that and oop in general)
-
My game uses A LOT of module scripts and instead of connecting them all with setmetatable() (because it was 1. boring 2. long 3. non optimized for new modules) i decided to make a MODULELOADER which gets all of modules from the folder, requires it, gets functions and methods from it, then 3 tables is being created inside of player's SELF (self.Variables = {}, self.Tables = {}, self.Functions = {}).
-
After the SELF gets all of that stuff (variables, tables and functions), goes next:
for i, v in pairs(self.Variables) do
self[i] = v
end
(and the same for self.Tables and self.Functions)
Why i did that? BECAUSE i think i will get a SELF metatable with all of containing functions (like the SELF was having all of those functions itself instead of requiring modules and calling them and blah blah blah.
I don't know will it work or not but i got a problem here.
You see, there is a "cyclic table". I thought it was because when i passed the "table" to put it into self.Tables then the system thought like (module script is a table itself so i will put it into self.Tables()) so it got error. I removed it but still something gets me "cyclic table".
Bro, i spent 2 months just creating the oop system, i want to drop it all and make usual game without modules. Help me please.
Also write down what you think about those complex things i made and is it easier for me just to make usual shit-code game. 😄
help me
