diff options
Diffstat (limited to 'thing.lua')
| -rw-r--r-- | thing.lua | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,22 +1,22 @@ local class = require'r.class' -- author or channel or whatever --- tuple of (pylon, pylon-specific-descriptor, optional displayname) +-- tuple of (pylon, pylon-specific-descriptor (id), optional display name) local Thing = class() -function Thing.make(cls, pylon, descriptor, displayname) - displayname = displayname or descriptor +function Thing.make(cls, pylon, id, name) + name = name or id return setmetatable({ pylon=pylon, - descriptor=descriptor, - displayname=displayname, + id=id, + name=name, }, cls) end function Thing.__eq(self, other) - return self.pylon == other.pylon and self.descriptor == other.descriptor + return self.pylon == other.pylon and self.id == other.id end function Thing.__tostring(self) return self.pylon.name - .. ':' .. self.descriptor - .. (self.displayname == self.descriptor and '('..self.displayname..')' or '') + .. ':' .. self.id + .. (self.name == self.id and '('..self.name..')' or '') end return Thing |
