"tables cannot be cyclic"
log (from the compiled version):
codebase: https://github.com/msfyre/rpg_game/tree/battle-manager
script:
GitHub
GitHub - msfyre/rpg_game at battle-manager
Contribute to msfyre/rpg_game development by creating an account on GitHub.
Solution:Jump to solution
stupid fix (it worked somehow):
```typescript
export class BattleData
// prev code here...
8 Replies
1 in remotes you can't send instances of classes this is an error, because references to metatables will not be passed and you will have a typing violation (you can fix this on the client if you manually restore the metatable). 2 if inside the table being passed there is a reference to itself, then this is exactly what will cause this error, because the serializer tries to serialize data infinitely
Yeah, tesmi is right I think.
And what kind of class do you pass through remote event?
If it's smth like c# data class, it's prob better to replace with interface
custom ts class
Can you show?
the print is only there for debugging
^
And to remove any finality from it
Or
Just to create interface on top that holds data from class and pass it
So you have
class DataType{
ToRaw(): RawDataType
static FromRaw(RawDataType): DataType
}
Where raw data type is just interface with no functions
Apparently you have 1 million ways to go about this :3c
There are proper ones like ones above
And ugly but quick
so apparently encoding the class to a json works (sorta)
Solution
stupid fix (it worked somehow):