From 1ebd7d9b7b62c8e05d527611a1944ed1a876b890 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 3 Feb 2023 19:37:28 +0000 Subject: debug drawing change, zoom clamping, partial refactoring of class mechanisms to allow inheritance, minor refactor of noise generator, changes to temp worldgen, rework of class constructor mechanism --- common/class.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common/class.lua (limited to 'common/class.lua') diff --git a/common/class.lua b/common/class.lua new file mode 100644 index 0000000..37cf7bd --- /dev/null +++ b/common/class.lua @@ -0,0 +1,23 @@ +local function class() + local T = {} + T.__index = T + return T +end + +local function extend(Base) + local T = {} + T.__index = T + 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}) +end + +return setmetatable({ + class=class, + extend=extend +},{__call=class}) + + -- cgit v1.2.3