blob: 03c746eb320398f30bb0447ae3b5140efdc72c42 (
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
|
------------------------------------------------------------------------------
-- lm_props.lua:
-- Property markers.
------------------------------------------------------------------------------
PropertiesDescriptor = { }
PropertiesDescriptor.__index = PropertiesDescriptor
function PropertiesDescriptor:new(properties)
local pd = { }
setmetatable(pd, self)
pd.props = properties
return pd
end
function PropertiesDescriptor:write(marker, th)
lmark.marshall_table(th, self.props)
end
function PropertiesDescriptor:read(marker, th)
self.props = lmark.unmarshall_table(th)
setmetatable(self, PropertiesDescriptor)
return self
end
function PropertiesDescriptor:property(marker, pname)
return self.props and self.props[pname] or ''
end
function props_marker(props)
return PropertiesDescriptor:new(props)
end
|