i was using testing the classic library and notice nobody made a version for pico8 ,
the main motive probally is because pico8 uses tokens to limit your scope ,so something like oop can be really token intesive but, i made it anyways so here is classic in pico8.
--classic but in pico8 --class class={} class.__index=class function class:ext() local nclass={} for k,v in pairs(self) do if sub(k,1,1)=="_" and sub(k,2,2)=="_" then nclass[k]=v end end nclass.super=self nclass.__index=nclass setmetatable(nclass,self) return nclass end function class:new() end function class:__call(...) local obj=setmetatable({},self) obj:new(...) return obj end |
tip:use with responsibility.
P#116842 2022-09-03 19:40 ( Edited 2022-09-03 19:41)
[Please log in to post a comment]