summaryrefslogtreecommitdiff
path: root/xmpp/xml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/xml.lua')
-rw-r--r--xmpp/xml.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/xmpp/xml.lua b/xmpp/xml.lua
index e54f27f..93186f6 100644
--- a/xmpp/xml.lua
+++ b/xmpp/xml.lua
@@ -26,17 +26,15 @@ local function parseargs(s)
return arg
end
-local function tag(x)
- return setmetatable(x, {__call=function(x, label)
- -- search for child with given label
- for _,c in ipairs(x) do
- if c.label == label then
- return c
- end
+local tag_mt = {
+ __call = function(self, label)
+ for _,child in ipairs(self) do
+ if child.label == label then return child end
end
return nil
- end})
-end
+ end,
+}
+local function tag(x) return setmetatable(x, tag_mt) end
local psingle