Lua Class
Never
createClass = function(...) -- "result" is the new class local result, bases = {}, {...} -- copy base class contents into the new class for i, base in ipairs(bases) do for k, v in pairs(base) do result[k] = v end end -- set the class's __index, and start filling an "is_a" table that contains this class and all of its bases -- so you can do an "instance of" check using my_instance.is_a[MyClass] result.__index, result.is_a = result, {[result] = true} for i, base in ipairs(bases) do for c in pairs(base.is_a) do result.is_a[c] = true end result.is_a[base] = true end -- the class's __call metamethod setmetatable(result, { __call = function (cls, ...) local instance = setmetatable({}, cls) -- run the init method if it's there local init = instance._init if init then init(instance, ...) end return instance end }) -- return the new class table, that's ready to fill with methods return result end Panel = createClass() function Panel:_init(x, y) self.x = x self.y = y end function Panel:Print() print("X: " .. self.x .. "; Y: " .. self.y) end panel = Panel(1,1) panel:Print()
Raw Text
-
Perfect 10 College Babe Rammed Analy - Hazel Moore - DarkX
10 min ago
-
Untitled
28 min ago
-
Untitled
31 min ago
-
Untitled
37 min ago
-
Untitled
41 min ago
-
Hottie get hardcore fucked by grandpa on the couch and she swallows his jizz
41 min ago
-
Untitled
55 min ago
-
Untitled
58 min ago
-
CP😏 LOL1🍬👧 FOLDERS💯📁 //PEDOMON♥️🍼//R@PE😈//ZOO🐶
58 min ago
-
Untitled
1 hour ago