Steamworks FFI

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
ivan
Party member
Posts: 1546
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Steamworks FFI

Post by ivan » Tue Dec 17, 2019 8:47 am

This is a cross-platform LuaJIT/FFI wrapper for Steamworks v1.47. The library provides easy and simple Steamworks integration, using the original redistributable binaries provided by Valve.

https://bitbucket.org/itraykov/sworks-ffi/src/master/

grump
Party member
Posts: 595
Joined: Sat Jul 22, 2017 7:43 pm

Re: Steamworks FFI

Post by grump » Tue Dec 17, 2019 10:45 am

Code: Select all

ffi.C.strtoull("0xffffffffffffffff", nil, 16)
LuaJIT accepts a ULL suffix for this.

Code: Select all

0xffffffffffffffffULL

User avatar
raidho36
Party member
Posts: 1994
Joined: Mon Jun 17, 2013 12:00 pm

Re: Steamworks FFI

Post by raidho36 » Tue Dec 17, 2019 1:36 pm

Yeah, I mean, it's LuaJIT-exclusive anyway, you can't make this work in regular Lua.

User avatar
ivan
Party member
Posts: 1546
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Steamworks FFI

Post by ivan » Tue Dec 17, 2019 2:35 pm

Thanks grump, I will add that change although I have tested it and it works fine with either:

Code: Select all

a = ffi.C.strtoull("0xffffffffffffffff", nil, 16)
b = ffi.C.strtoull("0xffffffffffffffffULL", nil, 16)

assert(a == b)
In general, pure Lua can't handle such large numbers:

Code: Select all

n = 0xffffffffffffffff

grump
Party member
Posts: 595
Joined: Sat Jul 22, 2017 7:43 pm

Re: Steamworks FFI

Post by grump » Tue Dec 17, 2019 2:41 pm

ivan wrote:
Tue Dec 17, 2019 2:35 pm
In general, pure Lua can't handle such large numbers:

Code: Select all

n = 0xffffffffffffffff
The point is that you can use the ULL suffix to write 64 bit integer literals directly in LuaJIT, there's no need to call strtoull.

Code: Select all

assert(0xffffffffffffffffULL == ffi.C.strtoull("0xffffffffffffffff", nil, 16))
http://luajit.org/ext_ffi_api.html (see "Extensions to the Lua parser" at the bottom of the page)

User avatar
ivan
Party member
Posts: 1546
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Steamworks FFI

Post by ivan » Tue Dec 17, 2019 2:55 pm

I see, that's even better. I will have to see how this change would affect the rest of the code.
Thanks grump!

User avatar
ReFreezed
Citizen
Posts: 75
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Steamworks FFI

Post by ReFreezed » Mon Jan 06, 2020 10:56 am

Nice, this is very useful!
Tools: LuaPreprocess, LuaHotLoader
Games: Momento Temporis: Light from the Deep, Momento Temporis: Arena, Energize!
"If each mistake being made is a new one, then progress is being made."

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests