summaryrefslogtreecommitdiff
path: root/template/lib/classic.lua
diff options
context:
space:
mode:
authorIndrajith K L2025-11-05 01:50:32 +0530
committerIndrajith K L2025-11-05 01:50:32 +0530
commit10c22d35678f96e722f25a12badca98febb2921e (patch)
treefe71581d11747f32ceebb31839034d61e7a55614 /template/lib/classic.lua
parent2d565e5bcb0e2eab93d9d1bab520bbbaf7457a07 (diff)
downloadreilua-enhanced-10c22d35678f96e722f25a12badca98febb2921e.tar.gz
reilua-enhanced-10c22d35678f96e722f25a12badca98febb2921e.tar.bz2
reilua-enhanced-10c22d35678f96e722f25a12badca98febb2921e.zip
Adds Game Jam Ready Templates & ReiLua API Updates
(Most of the code is Copilot Generated LOL)
Diffstat (limited to 'template/lib/classic.lua')
-rw-r--r--template/lib/classic.lua67
1 files changed, 67 insertions, 0 deletions
diff --git a/template/lib/classic.lua b/template/lib/classic.lua
new file mode 100644
index 0000000..379b6da
--- /dev/null
+++ b/template/lib/classic.lua
@@ -0,0 +1,67 @@
+--
+-- classic
+--
+-- Copyright (c) 2014, rxi
+--
+-- This module is free software; you can redistribute it and/or modify it under
+-- the terms of the MIT license. See LICENSE for details.
+--
+
+local Object = {}
+Object.__index = Object
+
+
+function Object:new()
+end
+
+
+function Object:extend()
+ local cls = {}
+ for k, v in pairs(self) do
+ if k:find("__") == 1 then
+ cls[k] = v
+ end
+ end
+ cls.__index = cls
+ cls.super = self
+ setmetatable(cls, self)
+ return cls
+end
+
+
+function Object:implement(...)
+ for _, cls in pairs({...}) do
+ for k, v in pairs(cls) do
+ if self[k] == nil and type(v) == "function" then
+ self[k] = v
+ end
+ end
+ end
+end
+
+
+function Object:is(T)
+ local mt = getmetatable(self)
+ while mt do
+ if mt == T then
+ return true
+ end
+ mt = getmetatable(mt)
+ end
+ return false
+end
+
+
+function Object:__tostring()
+ return "Object"
+end
+
+
+function Object:__call(...)
+ local obj = setmetatable({}, self)
+ obj:new(...)
+ return obj
+end
+
+
+return Object