Server Query API using LuaSocket

The library is called serverquery (It needs lua sockets to work, threading is your own dilemma and personal choice, I dont know if there’s a module for lua sockets to support threading, this code isn’t supportive of it)

Functions that work:
serverquery.GetMasterServerList(stringGameName,strParameters [, numTimeoutInSeconds]) --Example (‘garrysmod’,"
app\500\0"), returns a table of servers, each server being {<ip>,<port>}
serverquery.GetLatency(stringIPAddress [, numberPort [, numTimeoutInSeconds ] ]) --Returns millisecond latency
serverquery.GetServerInfo(stringIPAddress [, numberPort [, numTimeoutInSeconds ] ]) --Returns string hostname

Functions that don’t work because I am having difficulties with the challenge number and how to use it in the context of RULES query and other queries requiring challenge numbers.
serverquery.GetServerRules(stringIPAddress [, numberPort [, numTimeoutInSeconds ] ])
serverquery.GetChallengeNumber(stringIPAddress [, numberPort [, numTimeoutInSeconds ] ]) --dont know where the 4 byte challenge number is, or it keeps fucking up with my code to extract it…

If anybody has suggestions on how to fix my failure in the challenge number usage please post something that could help or point out the problem.

I have already thoroughly looked at both of valve’s documentation pages:

Very nice. This will surely be useful for a lot of people.


I didn’t know steam condenser had a lua api: