uspgamedev / luasteam

Bindings to connect lua with Steam API
https://luasteam.readthedocs.io/en/stable/
MIT License
116 stars 19 forks source link

Functions for game-server #13

Closed Lua200 closed 3 years ago

Lua200 commented 3 years ago

Hey :)

Is it possible to implement these functions?

Could u please help me? I dont really know to write the code...

For example: ISteamUser::GetAuthSessionTicket returns HAuthTicket. What kind of return value would that be in luasteam?

Thanks in advance and happy new year! :D

yancouto commented 3 years ago

Should be possible, yes. I'd be glad to review PRs. Take a look at our CONTRIBUTING.md.

If you take a look at Steam documentation, HAuthTicket is an identifier, and uint32. It is fine to use our uint64 metadata in this case.

What's a little more confusing is the "ticket" information returned. It seems on C++ you pass in a void pointer and a maximum size, and it returns the actual size. I assume that this is just any blob of information (an array of bytes). Luckily, in Lua strings can hold arbitrary data (they can have zeroes in the middle, unlike usual C strings). So you should be able to return a string for that call, in our C++ code you can use something like lua_pushlstring.

I imagine the API for GetAuthSessionToken would look something like this:

user.getAuthSessionToken(maxLength)

Parameters:
 - (number) maxLength - Maximum possible size of the auth ticket returned. Defaults to 1024, which should be enough.
 Return:
- (unit64) ID of the ticket (this is the HAuthTicket)
- (string) The auth ticket, encoded as a string. It may have zeroes in its representation.

I'm not sure how you will be using this string, and not sure what guarantees Steam gives about this (if it can be nicely printed or not), but if Steam doesn't give any guarantees, you might need to be careful when sending this through the network (which I guess is what you want), depending on how you send it.

Lua200 commented 3 years ago

Thank you :)

I will try to implement it and tell u if it works :D

yancouto commented 3 years ago

Closing for inactivity. Feel free to reopen if you have more doubts.