love2d-community / love-api

The whole LÖVE wiki in a Lua table.
http://love2d-community.github.io/love-api/
300 stars 48 forks source link

Add parent type #44

Closed pablomayobre closed 7 years ago

pablomayobre commented 7 years ago

Parenttype is the direct parent Supertype which the Type inherits from.

This is useful to know which Type inherits from whom exactly so you can do stuff like:

setmetatable(Canvas,   {__index = Texture }) --Canvas   Parenttype is Texture
setmetatable(Texture,  {__index = Drawable}) --Texture  Parenttype is Drawable
setmetatable(Drawable, {__index = Object  }) --Drawable Parenttype is Object

So then Canvas has all the methods from Texture, Drawable and Object all it's Supertypes.

rm-code commented 7 years ago

Thanks ❤️

pablomayobre commented 7 years ago

No problem mate!