문제

I want to parse this XML http://steamcommunity.com/id/GreenMarineValve?xml=1 with Lua 5.1, there are some libraries like LuaXML but they do not support parsing from the URL.

Would you give me a link to a library to do that if there is any or some advice to achieve my goal?

-

More details for those who have experience with Steam's Web API, I basically want to convert "customURL" to Steam Community ID (steamID64), but I see there is no other way doing it without parsing that XML file, I could parse it from the URL if it was JSON format instead of XML.

Is there an API I'm missing which will take the customURL as a parameter and return the communityID ? Some related links to WebAPI: https://developer.valvesoftware.com/wiki/Steam_Web_API https://partner.steamgames.com/documentation/webapi

도움이 되었습니까?

해결책

If you know how to get the contents of a URL into a Lua string, then getting the fields you want is simple:

function get(data,name)
    return data:match("<"..name..">(.-)</"..name..">")
end

-- assumes C contains the downloaded contents
print(get(C,"customURL"))
print(get(C,"steamID64"))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top