Replies: 1 comment
-
I don't quite understand what you want to achieve. Are you trying to annotate the param
I assume that
---@class NpcEventSay
---@field npcId integer
---@param e NpcEventSay
function event_say(e) end
---@class PlayerEventSay
---@field playerId integer
---@type fun(e: PlayerEventSay)
local event_say = event_say
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have a lua project that has generic methods like
function event_say(e)
The params are based on the file context, so if a file is named global_player.lua then it'll be
---@param e PlayerEventSay
, otherwise as default it would be---@param e NpcEventSay
Is there a way to set default parameters, that is, any time a function meets the pattern
function event_say(e)
, and no params are set, to default to typing it to NpcEventSay? That way, I only need to override the defaults in player events, which are less common.If not, what route is best to support file-sensitive param support like this? Plugins?
Beta Was this translation helpful? Give feedback.
All reactions