Good day,
how can I inherit my PlayerClass with properties and functions in it, to my CannonClass.
here is my code for PlayerClass:
-- Player Class local P = {} local private\_int = 1 P.public\_int = 100 P.MyMethod = function() print("DO SOMETHING!!!") end return P
and here is my code to CannonClass:
-- Cannon Class local player = display.newGroup() player.barrel = display.newRect(0,0,10,30) player.barrel.anchorY = 1 player.barrel:setFillColor(1,0,0) player.mainBody = display.newRect(0,0,25,25) player:insert(player.barrel) player:insert(player.mainBody) -- Inheritance happens here, although I don't have an idea how to inherit in LUA -- so that when I create a new instance of cannon, I can use the .MyMethod from PlayerClass -- even though .MyMethod function cannot be found in CannonClass, but on PlayerClass instead