Using a 3rd party SDK in Codea (PlayFab)

Title says all. I’m trying to have the PlayFab Lua SDK work in Codea, but it always produces the same error: Module ‘...’ not found.
Here’s the code:
local IPlayFabHttps = require("PlayFab.IPlayFabHttps") local PlayFabSettings = require("PlayFab.PlayFabSettings")
This is found in every one of my files. Thing is those files exist in my tabs! Yes, I’ve tried removing the PlayFab., still nothing.

try to add this line of code at the beginning of your Main file (maybe it also needs to be the first tab…) to set up the path for require. Don’t forget to replace YOUR_PROJECT_NAME with it.

package.path = package.path .. ';' .. os.getenv('HOME') .. '/Documents/' .. YOUR_PROJECT_NAME .. '.codea/?.lua'

@HyroVitalyProtago Project name is ‘PlayFab’. Should it look like this? package.path = package.path .. ';' .. os.getenv('HOME') .. '/Documents/' .. 'PlayFab' .. '.codea/?.lua'

Seems right, does it work now?

@HyroVitalyProtago Nope.

@JosefLeventon You also need to remove the ‘PlayFab.’ at the begining of each require call like this :

local IPlayFabHttps = require("IPlayFabHttps")
local PlayFabSettings = require("PlayFabSettings")

@HyroVitalyProtago It works for require(“IPlayFabHttps”) but not for require(“PlayFabSettings”).

@HyroVitalyProtago Never mind, it works. Only thing I’m missing now is these:
local https = require("ssl.https") -- LuaSec 0.4+ local ltn12 = require("ltn12") -- LuaSec 0.4+
How do I get them?

You need to manually add these files, they can be found on github like ltn12 and maybe https, options and ssl here.

But I’m really not confident about getting the ssl.https from LuaSec to works because of its dependency on OpenSSL… If someone else know about a pure lua implementation or way to get this around…

@HyroVitalyProtago I managed to get ltn12 but there seems to be no file named ssl.https in the link you gave me.

@JosefLeventon Yep, https.lua is the file you’re looking for. But it won’t works because of the OpenSSL external dependency.

@Simeon Is there an ‘easy’ way to have https on Codea ?

For the moment, the only way is probably to code openssl in pure lua, but if you already have difficulties in using require, I don’t think that’s a good idea.

Can I ask why you want to use PlayFab in Codea ? It will be easier to integrate it in Love2D on a computer. If it’s just for multiplayer purpose, starts with raw sockets.

@HyroVitalyProtago when you say https do you mean just making requests to a https site?

@Simeon I think its about https request.

Sorry for the lack of context, but @JosefLeventon try to use the PlayFab Lua SDK that depends on LuaSec which depends on OpenSSL implementation.

So, the initial question is more: can LuaSec library be used in Codea?

Ps: thank you for responding so quickly!

@HyroVitalyProtago I’m mostly wanting to use it for microtransactions, login/signup and other features. I don’t expect to do multiplayer.

I see, LuaSec seems like an implementation of TLS over LuaSocket

@JosefLeventon is this for an exported Codea project in Xcode?

@Simeon I plan to use it to test some things inside Codea atm.

According to Simeon in DM, luasocket and lpeg are mostly the only important modules you can unpack.

So you have to require(‘luasocket’) first. Went to search for this, is this something you may search for? Note that in their example http.request goes a bit different than in codea.

@TokOut Thanks, but how do I install LuaSec?

@JosefLeventon I don’t think we could add LuaSec into the shipping version of Codea. It requires integrating OpenSSL on iOS which is non-trivial and would really increase the binary size of Codea

This is something you could possibly integrate in an exported Xcode project but putting OpenSSL into an iOS app is tricky (I’ve heard)

@Simeon Say if I were to add it to the Codea application files through Filza, would that work?