Skip to content

DetectedEvent in the type defs for luau should be a class #3

@WolfGangS

Description

@WolfGangS

The type def for DetectedEevent should use the class declaration method to allow users to use it in their scripts.

Currently it's a type

type DetectedEvent = {
    valid : boolean,
    index : number,
    can_change_damage : boolean,
    AdjustDamage : (self: DetectedEvent, Damage: number) -> nil,
    getDamage : (self: DetectedEvent) -> list,
    ...
}

As far as I know without a require import, types cannot be used in a script being checked by luau-lsp.

This results in dreaded red squiggles in code and no predictions

Image

Proposed fix

This may need to be done in part in the viewer project with the xml defs file

declare class DetectedEvent
    valid : boolean
    index : number
    can_change_damage : boolean
    function adjustDamage(self): nil
    function getDamage(self): list
    ...
end

Will allow users to make use of it properly

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions