FuzzyDunlop [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=41879 For the love of god, why does this not work (OOP Inheritance) <p>I'm just starting out in PICO-8 and messing around with OOP-style prototypal inheritance, so I tried to run the following code:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>myclass = {str = &quot;printme&quot;} function myclass:new(o) o = o or {} setmetatable(o,self) self._index = self return o end subclass = myclass:new() print(subclass.str)</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>...and it prints [nil] .</p> <p>Should it not print &quot;printme&quot;? What am I doing wrong here?</p> https://www.lexaloffle.com/bbs/?tid=36474 https://www.lexaloffle.com/bbs/?tid=36474 Mon, 06 Jan 2020 21:21:09 UTC