Why gdscript cannot inherit Array or Dictionary? #5840
Replies: 2 comments
-
A specific example is storing data as json. (This problem does not exist if resource scripts are used for storage, and json is selected only to facilitate network transmission) The data I store and read are There is no problem if there is only one player object. However, if the player also holds multiple equipment data, it will provide additional complexity. Because these equipment are similar to players, they are an object with their own functions and need to be packaged as a class. The more such nesting, the higher the complexity. Every object that is considered to exist independently will have two versions of data and class, and maintaining the consistency of the two versions of data is very painful. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The following code is prohibited:
This is very different from other languages.
If you want to expand an array by yourself, you must let a new class hold the array, but you cannot use for to traverse the array, such as
for elem in AClassHasArray
.Why is it designed like this?
This is very inconvenient at some times
Beta Was this translation helpful? Give feedback.
All reactions