rain_gloom Posted August 31, 2014 Share Posted August 31, 2014 How can I add custom OOP methods to a custom element type? eg.: (getElementsByType("myElementType")[1]):someCustomMethod() That should call a method on the element I created. It should also support exporting, if possible. What kind of constructor would I need? Does the new OOP support this? Link to comment
arezu Posted August 31, 2014 Share Posted August 31, 2014 myElementType = createElement("myElementType", "yolo") local myElementTypeClass = getmetatable(myElementType).__class function myElementTypeClass:testFunc() outputChatBox("my Element type id: "..getElementID(self)) end getElementsByType("myElementType")[1]:testFunc() Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now