red-blox / zap

A lightning fast networking solution for roblox.
https://zap.redblox.dev
MIT License
89 stars 14 forks source link

[BUG] String arrays in nested structs does not generate valid Luau #81

Closed AzzaDeveloper closed 2 months ago

AzzaDeveloper commented 4 months ago

Describe the bug

String arrays in nested structs causes resulting Luau code to attempt to create invalid variable names.

event Event = {
    from: Server,
    type: Unreliable,
    call: ManyAsync,
    data: struct {
        nested: struct {
            tags: string[]
        }
    }
}

will generate

local Value.nested_tags_v = Value.nested.tags[i]

Reproduction

Playground

Expected behavior

It should properly access nested values and generate valid code.