-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
As requested creating an issue for my question on how to approach this situation. Guessing there is no way currently given I was asked to create an issue :)
Discussed in #1331
Originally posted by muppet9010 July 14, 2022
I have the below concept and aren't sure how to go about properly type defining it. I have it as below and the typing almost works fine, apart from within the inner functions the parameters aren't getting their type.
---@alias EntityTypes table<string, EntityTypeDetails>
---@class EntityTypeDetails
---@field GetEntityName fun(name: string, count: integer): string
---@type EntityTypes
local EntityTypeDetails = {
tree = {
GetEntityName = function(name, count)
return name .. tostring(count)
end
},
rock = {
GetEntityName = function(name, count)
return name .. tostring(count + 1)
end
}
}
local x = EntityTypeDetails["tree"].GetEntityName("grey", 5)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request