Skip to content
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

Remove key-value obj -> map conversion #270

Open
Banaanae opened this issue Jul 29, 2024 · 0 comments
Open

Remove key-value obj -> map conversion #270

Banaanae opened this issue Jul 29, 2024 · 0 comments

Comments

@Banaanae
Copy link
Collaborator

V1:

Coord := {X: {X_REAL: 12, X_SUB: 8}, Y: {Y_REAL: 240, Y_SUB: 15}}
MsgBox % Coord.X.X_REAL

For key1, pos in Coord {
    For key2, realPos in pos {
        MsgBox % key1 ": {" key2 ": " realPos "}"
    }
}

V2 (Converted):

Coord := map("X", {X_REAL: 12, "X_SUB", 8), Y: {Y_REAL: 240, Y_SUB: 15}}
MsgBox(Coord.X.X_REAL)

For key1, pos in Coord {
    For key2, realPos in pos {
        MsgBox(key1 ": {" key2 ": " realPos "}")
    }
}

V2 (Expected):

Coord := {X: {X_REAL: 12, X_SUB: 8}, Y: {Y_REAL: 240, Y_SUB: 15}}
MsgBox(Coord.X.X_REAL)

For key1, pos in Coord.OwnProps() {
    For key2, realPos in pos.OwnProps() {
        MsgBox(key1 ": {" key2 ": " realPos "}")
    }
}

While conversion to map fixes for-loops, it breaks Coord.X.X_REAL
Broken for-loops can easily be fixed by appending .OwnProps()
Current obj->map conversion doesn't work with nested objs, not converting at all will easily fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant