Log In  
Follow
FuzzyDunlop

I'm just starting out in PICO-8 and messing around with OOP-style prototypal inheritance, so I tried to run the following code:

myclass = {str = "printme"}

function myclass:new(o)
 o = o or {}
 setmetatable(o,self)
 self._index = self
 return o
end

subclass = myclass:new()
print(subclass.str)

...and it prints [nil] .

Should it not print "printme"? What am I doing wrong here?

5 comments