tovector and toquaternion should accept tables as input
Tapple Gao
It would be nice if vectors and quaternions could be initialized from a table, like so:
tovector({1, 2, 3}) --> <1, 2, 3>
tovector({x=1, y=2, z=3}) --> <1, 2, 3>
toquaternion({1, 2, 3, 4}) --> <1, 2, 3, 4>
toquaternion({x=1, y=2, z=3, s=4}) --> <1, 2, 3, 4>
I don't have a really compelling use case, but I still think it would be nice
Log In
Tapple Gao
What made me think of it was just, storing a bunch of vectors in a script in a small amount of text. But,
- vector(1, 2, 3) is already decently compact (and probably the most memory-efficient)
- I can still use tovector("<1, 2, 3>")if I wanted textual compactness. Strings are also how they would be most naturally stored in a notecard too
Tapple Gao
A point against: then people might ask for
vector.asTable
and quaternion.asTable
just for symmetry. But I can think of 2 reasons those would be a less good idea:- Which format should they output? array or dict? or both?
- any application where either would be used would strongly prefer to use lljson.slencode if possible
Tapple Gao
The most compelling use case I can think of would be adapting lsl code that uses the
vec.x = 5
syntax sugar, but, it's not that hard to fix manually