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?
P#71795 2020-01-06 21:21 ( Edited 2020-01-06 21:21)