It looks like you're new here. If you want to get involved, click one of these buttons!
If i for example create a Player class and then create a Animal class and from the Animal class i want to check a variable in the Player class. The variable in the Player class would be called: "self.animal". So how to i from the Animal class check if the variable is true or not?
Comments
Not sure if this is exactly what you're after.
Well... i am not so sure about return things and so, but i have found another way to check variables. You set the variables on "function player:setup()" and then in the Animal class you write:
Animal=class
function Animal:setup()
Player:setup()
if self.animal== true then
command
end
end
and so on...
If you do this way you need to change the variables from self.animal to self.player.animal to sort things out. Thanks for answering anyway!
@MMGames - the way you check variables in another class is quite simple
if you wrote
and there is a property "self.score" in the Player class, then you can check its value for p with
@Ignatz - Thanks, got it now