Permalink
Browse files

Use metatables to copy less

  • Loading branch information...
o-jasper committed Oct 18, 2015
1 parent 0615fbb commit 989fd07b9c4ec20589951baed38ae6d28a461604
@@ -1,2 +1,2 @@
<td><a href="/chat/{%fa}/{%ta}">{%fa}</ta>:</td><td>{%name}</td></tr>
<td><a href="/chat/{%fa}/{%ta}">{%fa}</ta>:</td><td>{%contact_name}</td></tr>
<tr><td colspan=2>{%status_message}</td>
@@ -17,8 +17,7 @@ function This:repl(state)
if not self._repl then
self._repl = { kind = self.rest[1], msg = self.rest[2], }
-- TODO want to display some history too..
for k,v in pairs(self) do self._repl[k] = v end
self._repl.i = self._repl.i or " "
self._repl = setmetatable(self._repl, {__index = self})
end
return self._repl
end
@@ -17,7 +17,7 @@ function This:repl()
if not self._repl then
self._repl = { fa = self.fa, ta = self.ta, name = self.contact_name }
-- TODO want to display some history too..
for k,v in pairs(self.claims) do self._repl[k] = v end
self._repl = setmetatable(self._repl, {__index = self.claims})
end
return self._repl
end

0 comments on commit 989fd07

Please sign in to comment.