I am using the Corona Editor in Sublime, which I am liking very much. Being prone to migraines, I especially like the black background (wish there was one on this page). I am using the Class stub to build out a Class called Card. I have no problem creating new cards, but I am having problems with using methods defined in the same file as the class.
function Card:setNumber (num)
self.cardNumber = num
print ("Card number is " … self.cardNumber)
end
is in Card.lua
and the call
cards[1]:setNumber(89) is in main.lua
cards[1] is a Card and I can get cards[1].number with no problem. So the object and attributes exists, but the function (method) is not getting inherited by the instance.
If I rewrite the function in main, then I can get it to work, but I would prefer the methods and instances be defined in the Class lua file.
Has anyone dealt with this?