diff options
Diffstat (limited to 'thing.lua')
| -rw-r--r-- | thing.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/thing.lua b/thing.lua new file mode 100644 index 0000000..33a4bb1 --- /dev/null +++ b/thing.lua @@ -0,0 +1,22 @@ +local class = require'r.class' +-- author or channel or whatever +-- tuple of (pylon, pylon-specific-descriptor, optional displayname) + +local Thing = class() +function Thing.make(cls, pylon, descriptor, displayname) + displayname = displayname or descriptor + return setmetatable({ + pylon=pylon, + descriptor=descriptor, + displayname=displayname, + }, cls) +end +function Thing.__eq(self, other) + return self.pylon == other.pylon and self.descriptor == other.descriptor +end +function Thing.__tostring(self) + return self.pylon.name + .. ':' .. self.descriptor + .. (self.displayname == self.descriptor and '('..self.displayname..')' or '') +end +return Thing |
