Steamworks FFI
Steamworks FFI
This is a cross-platform LuaJIT/FFI wrapper for Steamworks. The library provides easy and simple Steamworks integration, using the original redistributable binaries provided by Valve.
https://bitbucket.org/itraykov/sworks-ffi/src/master/
https://bitbucket.org/itraykov/sworks-ffi/src/master/
Last edited by ivan on Fri Sep 04, 2020 5:40 am, edited 1 time in total.
Re: Steamworks FFI
Code: Select all
ffi.C.strtoull("0xffffffffffffffff", nil, 16)
Code: Select all
0xffffffffffffffffULL
Re: Steamworks FFI
Yeah, I mean, it's LuaJIT-exclusive anyway, you can't make this work in regular Lua.
Re: Steamworks FFI
Thanks grump, I will add that change although I have tested it and it works fine with either:
In general, pure Lua can't handle such large numbers:
Code: Select all
a = ffi.C.strtoull("0xffffffffffffffff", nil, 16)
b = ffi.C.strtoull("0xffffffffffffffffULL", nil, 16)
assert(a == b)
Code: Select all
n = 0xffffffffffffffff
Re: Steamworks FFI
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.ivan wrote: ↑Tue Dec 17, 2019 2:35 pmIn general, pure Lua can't handle such large numbers:Code: Select all
n = 0xffffffffffffffff
Code: Select all
assert(0xffffffffffffffffULL == ffi.C.strtoull("0xffffffffffffffff", nil, 16))
Re: Steamworks FFI
I see, that's even better. I will have to see how this change would affect the rest of the code.
Thanks grump!
Thanks grump!
Re: Steamworks FFI
Nice, this is very useful!
Tools: Hot Particles, LuaPreprocess, (more)
Games: Momento Temporis: Light from the Deep, Energize!
"If each mistake being made is a new one, then progress is being made."
Games: Momento Temporis: Light from the Deep, Energize!
"If each mistake being made is a new one, then progress is being made."
Re: Steamworks FFI
Just pushed an update upgrading the library to Steamworks v1.5.
This version includes supports for HTTP and HTTPS requests similarly to luasocket:
That's right, we've got working SSL support too!
This version includes supports for HTTP and HTTPS requests similarly to luasocket:
Code: Select all
valid = steam.request(url[, body, callback])
Re: Steamworks FFI
I know this might be a silly question:
Where should I put libsteam_api.dylib in a Mac build?
I tried to put libsteam_api.dylib in the folder, inside .love file or in love.exe's folder.
None of them worked.
Error
dlopen(libsteam_api.dylib, 5): image not found
Traceback
[builtin#202]: at 0x010c345e00
[C]: in function 'require'
sworks/api.lua:43: in function 'Init'
sworks/main.lua:16: in function 'init'
main.lua:73: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Where should I put libsteam_api.dylib in a Mac build?
I tried to put libsteam_api.dylib in the folder, inside .love file or in love.exe's folder.
None of them worked.
Error
dlopen(libsteam_api.dylib, 5): image not found
Traceback
[builtin#202]: at 0x010c345e00
[C]: in function 'require'
sworks/api.lua:43: in function 'Init'
sworks/main.lua:16: in function 'init'
main.lua:73: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Re: Steamworks FFI
On Mac, I placed mine in:
Please confirm if this works for you.
Code: Select all
Contents/Frameworks/libsteam_api.dylib
Who is online
Users browsing this forum: No registered users and 10 guests