blob: f7cc32a9f6d410d604cbcf7f17d9258efd2f1773 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
local class = require'r.class'
-- author or channel or whatever
-- tuple of (pylon, pylon-specific-descriptor (id), optional display name)
local Thing = class()
function Thing.make(cls, pylon, id, name)
name = name or id
return setmetatable({
pylon=pylon,
id=id,
name=name,
}, cls)
end
function Thing.__eq(self, other)
return self.pylon == other.pylon and self.id == other.id
end
function Thing.__tostring(self)
return self.pylon.name
.. ':' .. self.id
.. (self.name == self.id and '('..self.name..')' or '')
end
return Thing
|