fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
27686d7
settings-overhaul
1local class ={ 2structs ={} , 3inherits ={} , 4} 5 6function ACCESSOR ( object , name , internal , default ) 7if not object then 8return error ( "attempt to call ACCESSOR on a nil value" ) 9end 10object [ internal ] =default 11if type ( default ) == "boolean" then 12object [ "Is" .. name ] =function ( this ) return this [ internal ] end 13end 14object [ "Get" .. name ] =function ( this ) return this [ internal ] end 15object [ "Set" .. name ] =function ( this , value ) this [ internal ] =value end 16end 17 18local CLASS ={} 19CLASS . __index =CLASS 20 21function CLASS : ACCESSOR ( name , internal , default ) 22return ACCESSOR ( self , name , internal , default ) 23end 24 25function CLASS : extends ( basename ) 26class . inherits [ self . __classname ] =basename 27return self 28end 29 30function class . create ( classname , basename ) 31local struct ={} 32struct . __classname =classname 33struct . __constructor =classname 34class . structs [ classname ] =struct 35class . inherits [ classname ] =basename 36return setmetatable ( struct , CLASS ) 37end 38 39function class . getStruct ( classname ) 40return class . structs [ classname ] 41end 42 43function class . getBaseClassname ( classname ) 44return class . inherits [ classname ] 45end 46 47return class