-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
struct_get_by_index or struct_get_values & accesor #8578
Comments
indexing for structs is not possible as they are, by design, unordered. if you grab a struct off a database on tuesday then whatever is conceptually first in the struct may not be the same if you snatch it again on thursday. if you need order then you should be using an array. a function to grab an array of values would be cool, but determining which struct field each value in that array goes to wouldn't be fun because of the unorderedness of structs. really does sound like you just want an array heh |
Is that really the case? I receive them as a json string and the order is the same as the write order, I mean when using the function struct_get_names. And I'm not asking for that much, just a function that works on whatever order struct_get_names do, better if it's not needed to create a whole array to access to a single value, but if not, array is cool as u say. |
Closing as above. |
that is the case, yeppers. like stuckie said, the order is not stable. just because you are seeing a predictave/determined order on your machine does not mean you always would or that your players would at all. its literally happenstance heh |
Is your feature request related to a problem?
I would like to access with ease to struct members by index. Just that.
An example where I need this:
When getting values from an internet database, sometimes I get nested structs like this:
Describe the solution you'd like
To add one or both of the next functions.
struct_get_by_index(struct, index) => Gets "index" element of the struct (ordered by default way) .
struct_get_values(struct) => Similar to struct_get_names except it rater returns the values on the array.
It would be much cool if you add a way to access to those values by index on an accessor but I don't know the implications of having a single data structure with multiple accessor types.
Describe alternatives you've considered
I currently do this if it can give you an idea how could an accessor of the kind be used
Additional context
No response
The text was updated successfully, but these errors were encountered: