A Lua XML parser?

I’m creating an addon that uses stuff from a player’s Steam Community page to determine if they’re in a group, or if they’ve played the game enough, but I can’t determine whether Lua itself has an XML parser, if someone built one, or if Garry’s Mod has one. I’m just wondering if anyone knows if one exists already before I go out and re-invent the wheel.

[sp]It has something to do with giving privileges to members of a certain steam group, required time played, previous name, etc.[/sp]

Edit: Can gm_steamworks/opensteamworks do this?

Those are modules for input with the steam client. They can’t be used to parse XML. Use this instead:

function parseargs(s)
local arg = {}
string.gsub(s, “(%w+)=([”’])(.-)%2", function (w, _, a)
arg[w] = a
return arg

function collect(s)
local stack = {}
local top = {}
table.insert(stack, top)
local ni,c,label,xarg, empty
local i, j = 1, 1
while true do
ni,j,c,label,xarg, empty = string.find(s, “<(%/?)([%w:]+)(.-)(%/?)>”, i)
if not ni then break end
local text = string.sub(s, i, ni-1)
if not string.find(text, “^%s*") then table.insert(top, text) end if empty == "/" then -- empty element tag table.insert(top, {label=label, xarg=parseargs(xarg), empty=1}) elseif c == "" then -- start tag top = {label=label, xarg=parseargs(xarg)} table.insert(stack, top) -- new level else -- end tag local toclose = table.remove(stack) -- remove top top = stack[#stack] if #stack &lt; 1 then error("nothing to close with "..label) end if toclose.label ~= label then error("trying to close "..toclose.label.." with "..label) end table.insert(top, toclose) end i = j+1 end local text = string.sub(s, i) if not string.find(text, "^%s*”) then
table.insert(stack[#stack], text)
if #stack > 1 then
error("unclosed "…stack[stack.n].label)
return stack[1]

print(collect(’<methodCall kind=“xuxu”>

I’ll play around with it a bit, but what I meant was could I use OSW to pull whether someone was in a group or not. Again, my main goal is to be able to tell if someone has played X time on a game and is in Y group.