2023-01-18 15:12:48 +01:00
|
|
|
Object = {}
|
|
|
|
|
|
|
|
function Object:prototype(o)
|
2023-01-25 17:01:01 +01:00
|
|
|
o = o or {} -- create table if user does not provide one
|
|
|
|
setmetatable(o, self)
|
|
|
|
self.__index = self
|
|
|
|
self.__tostring = o:tostring()
|
|
|
|
return o
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function Object:new(o)
|
2023-01-25 17:01:01 +01:00
|
|
|
local obj = self:prototype(o)
|
|
|
|
obj:initialize()
|
|
|
|
return obj
|
|
|
|
end
|
|
|
|
|
|
|
|
function Object:tostring()
|
|
|
|
return ""
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function Object:print()
|
2023-01-25 17:01:01 +01:00
|
|
|
print(self:tostring())
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function Object:initialize()
|
|
|
|
end
|
|
|
|
|
|
|
|
function Object:asJSON()
|
2023-01-25 17:01:01 +01:00
|
|
|
return '{}'
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function Object:inherit(o)
|
2023-01-25 17:01:01 +01:00
|
|
|
return self:prototype(o)
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function Object:extends(o)
|
2023-01-25 17:01:01 +01:00
|
|
|
return self:inherit(o)
|
2023-01-18 15:12:48 +01:00
|
|
|
end
|
|
|
|
|