Hi All,
I am getting back into Gideros after a while, and I seem to have forgotten some very basic class stuff! Feel free to give me a heads up how this should work.
I have my "main" class:
| Home = gideros.class(SpriteBase)
|
| function Home:init()
| bl = myclass.new()
| bl.method1()
| bl.method2()
| end
|
| home = Home.new()
I then have this code for my class.
| myclass= gideros.class(SpriteBase)
|
| function myclass:init(images, speed)
| self.here = "i want to print this"
| -- print it here
| print(self.here)
| end
|
| function myclass:method1()
| -- here
| print(self.here)
| end
|
| function myclass:method2()
| -- and here
| print(self.here)
| end
Can someone tell me what the print calls from method1 and method2 print?
Using something like C# or a "true" OOP language, they should print "i want to print this" because the self (as in self.here) would be the "same" self that exists in the methods...can someone tell me how best to mimic this in Gideros? I can pass a copy of myclass to each method...but that just seems very messy.
Thanks for your help!
Comments
Such a silly mistake taking so much time...