-
Currently dealing with a file format where I want to look recursively at structs and create custom logic based off that. For example, say TL:DR: I want to essentially do
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Loops cannot be used inside of structs. Instead you want to create an array of structs which will function as the loop. The function std::core::array_index() tends to be very useful for this kind of setup because it gives you access inside the struct you are making an array of to the current index being processed so you can use it to index placed arrays that maybe located at the parent struct using the parent keyword. If still unsure I can try to post some code if you can give a minimal example description of what you are trying to do. |
Beta Was this translation helpful? Give feedback.
My aim is not to write the exact code you want to end up using. My only intent is to show how to read an array of structs that have their addresses specified by a previously read array of offsets. That is only the part that you are writing fake code for presumably because you are unsure how ImHex can do that operation. My idea is that once that is understood, the other details for your particular pattern should no be that complicated.
Here is the problem. Youwant to perform this operation
for all values of i between 0 and header.num_sections as if it was being done in a loop. As explained, loops cannot be used inside structs …