diff options
| author | ubq323 <ubq323@ubq323.website> | 2025-11-02 20:10:38 +0000 |
|---|---|---|
| committer | ubq323 <ubq323@ubq323.website> | 2025-11-02 20:10:38 +0000 |
| commit | 0b7a7ed12e96e9111f4761a16cc18a49071ce922 (patch) | |
| tree | a298ef5b11ca7ab359de142857129762fea78322 | |
| parent | caf0562ce8e97fb1ab1b4a74de83df5c05761c5e (diff) | |
fix calling derived classes to construct
| -rw-r--r-- | class.lua | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -13,14 +13,13 @@ local function class() end local function extend(Base) - local T = {} - T.__index = T + local T = class() for k,v in pairs(Base) do if k:sub(1,2) == "__" and k~="__index" then T[k]=v end end - setmetatable(T,{__index=Base}) + getmetatable(T).__index = Base return T end |
