Because it feels redundant to call “stat.Speed.Speed”. Additionally I want to replicate how something like vector3 not only when called returns a vector3 value but has methods attached to the objects as well.
With what you are suggesting, it’s like having to get a vector3 value by calling “vector3.vector3” instead of just saying “vector3”.
In my case when I call “stat.Speed” it returns “10”, but it also has member methods and values I can call.
Whenever you try to print out a table, it will try to invoke it’s __tostring method. If it exists, it will return whatever that function returns. If it does not, it will print out the table like normal.
By modifying that method, I can have it return a number and then use that method to modify the mathematical methods of the table in order to have it behave like a number, while still having the properties of a table.
There are probably better ways to go about this, but this is just a quick solution I found to the strange question that you asked.
And no, you do not have to do print(test.speed + 0) in order to retrieve the numerical value. You can simply do print(test.speed).