Skip to content

How to define type hints for user callback functions #3371

@ChillerDragon

Description

@ChillerDragon

I am working on a lua api for a C++ game. And users creating these plugins can implement global function that will be called by C++. I tried putting a few type hints into my meta file like these but it did not properly let me autocomplete function on_<tab>

---@meta

---@type fun(client_id: integer)
on_player_connect = nil
functions.mp4
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