How to overload indexing? #2442
|
I'm trying to write a definition file for a c++ class being loaded into a Lua environment, and one of my classes has an overloaded index operator. I can't seem to find anything in the github.io documentation on how to overload the index operator in particular. Does that feature exist already, and if so how do you write it? Thanks |
Answered by
firas-assaad
Feb 18, 2024
Replies: 3 comments
|
Not sure if bumping is frowned upon here, but I still have not found an answer to this in documentation or previous discussions. Even if the answer is it not being a supported feature I'd love to take it off my todo list. |
0 replies
|
By index operator, do you mean something like this? ---@class Class
---@field bool boolean
---@field [string] integer
---@field [integer] string
local class
local bool = class.bool
local int = class.string
local str = class[3] |
0 replies
Answer selected by
loganmcbroom
|
That is exactly it, thank you. Maybe my not being a Lua native is showing. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By index operator, do you mean something like this?