#Reference to self in Type?

19 messages · Page 1 of 1 (latest)

dusty basin
#

show code so i have an approximate idea on what you're trying to achieve

river osprey
#
export type Path = {
    Path: Path,
    Agent: Model,
    Humanoid: Humanoid,
    AgentParemeters: {any},
    
    LastTime: number,
    
    Position: {
        Count: number,
        Last: Vector3
    },
    
    Connections: {RBXScriptSignal?},
    
    VisualWaypoints: {BasePart?},
    
    Run: (Vector3) -> nil,
    Destroy: () -> nil,
}
#

I have this type here right

dusty basin
#

ooh i see

river osprey
#

basically the last 2 definitions

#

how can I change Run and Destroy

dusty basin
#

you probably want Destroy: (self: Path) -> nil

river osprey
#

in order to reference that it's sending itself

north prawn
#

^

dusty basin
#

Run: (self: Path, argName: Vector3) -> nil

dusty basin
#

so you know what you're providing exactly

river osprey
#

great it picks it up

river osprey
dusty basin
#

yes

river osprey
#

didnt know

#

ty

#

that's all ty