View source for Module:Color/utils/class
From Space Station 14 Wiki
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
-- Code based on:
-- http://lua-users.org/wiki/SimpleLuaClasses
--- Helper function to create classes
--
-- @usage local Color = class(function () --[[ constructor ]] end)
-- @usage local Color2 = class(
-- Color,
-- function () --[[ constructor ]] end,
-- { prop_a = "some value" }
-- )
local function class(base, init, defaults)
local c = defaults or {} -- a new class instance
if not init and type(base) == 'function' then
init = base
base = nil
elseif type(base) == 'table' then
-- our new class is a shallow copy of the base class!
for i,v in pairs(base) do
c[i] = v
end
c._base = base
000
1:0
Template used on this page:
Return to Module:Color/utils/class.