Can’t find any resources to this in DevForum, considering I don’t know the actual name anyway
Heyo, I am currently creating a brand new UI framework that is designed to be completely modular. While creating some of the components, I have a question in my mind: Can you index through a table, and the table itself can also act as a function?
If you have a stroke reading the title, or purely don’t understand my level of English, I’ll explain it here.
I’ve seen modules with this type of design, so I am quite sure this is possible.
local module = require(script.mod) -- a table
module() -- a function
module.indexOne() -- also a function
Et cetera.
I know this will probably require some metatables magic but I am not sure how should I go implement something like that. If someone can help me out and know how to implement this, please do!