blob: a704004872e5268feba5f42d753f2e0b30fe143c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
------------------------------------------------------------------------------
-- lm_desc.lua:
-- Portal descriptor markers.
------------------------------------------------------------------------------
PortalDescriptor = { }
PortalDescriptor.__index = PortalDescriptor
function PortalDescriptor:new(properties)
local pd = { }
setmetatable(pd, self)
pd.props = properties
return pd
end
function PortalDescriptor:write(marker, th)
lmark.marshall_table(th, self.props)
end
function PortalDescriptor:read(marker, th)
self.props = lmark.unmarshall_table(th)
setmetatable(self, PortalDescriptor)
return self
end
function PortalDescriptor:feature_description(marker)
return self.props.desc
end
function PortalDescriptor:property(marker, pname)
return self.props and self.props[pname] or ''
end
function portal_desc(props)
return PortalDescriptor:new(props)
end
|