AggrorJorn Posted December 12, 2016 Share Posted December 12, 2016 Does anybody have good experience using a lua lib for calling webservices/making http requests? Currently looking at Luasockets but tinkering about whether this is even possible when you are making a game using the Leadwerks game player. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 12, 2016 Share Posted December 12, 2016 I've asked josh to give us a generic interface for this since he's in there doing it specifically for that API that allows us to track what players are doing. I doubt we will have that anytime soon, if at all though. He seems to be focusing on this specific API he's working with. Other than that anything that allows this via Lua would require an external non Lua library which means it's not going to work for the game player. 1 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 12, 2016 Author Share Posted December 12, 2016 Thanks for confirming Rick. I was afraid that was the situation. Nothing that can be done on our part then. Here's hoping he exposes some of that functionality to a network class. Quote Link to comment Share on other sites More sharing options...
Einlander Posted December 12, 2016 Share Posted December 12, 2016 you can use luajit ffi, if you have to. http://www.leadwerks.com/werkspace/blog/120/entry-1182-luajit-awesome-luajit-enet-loaded/ the code there is super old, so just take it as inspiration because it's so bad. This are some repos that deal with curl in lua. https://github.com/Playermet/CurLua https://gist.github.com/LPGhatguy/09d3955207ab35d96e97 These will not work in the sandbox and thus not in the game player. As you probably know. You need to have the proper curl lib for the os installed in the same directory as the exe. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 13, 2016 Share Posted December 13, 2016 What do you want to use this for? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 13, 2016 Author Share Posted December 13, 2016 What I want to achieve is to call a rest api to either post, update or get data. Prefferably via JSON or XML. For the winter games tournament I am making, I rely on level seeds. Highscores are currently saved to Steam highscores, but I can't store which popular seeds are being used by others. In general there is so much data that I want to store for usefull game mechanics and stats. Something like this: --Realy basic pseudo Get request var request = new Request() request.Url = "http://mysite.com/api/v1/popularseeds" request.Method = HttpMethod.Get var jsonResult = request.Execute() --Realy basic pseudo Post request var request = new Request() request.Url = "http://mysite.com/api/v1/popularseeds" request.Method = HttpMethod.Post var jsonString = "'user':'Aggror', 'attempts':'4', 'positions':{ '12345', '5674' }" request.AddBody(jsonString) request.AddParameter("hmac", "124362346") var jsonResult = request.Execute() Quote Link to comment Share on other sites More sharing options...
Josh Posted December 13, 2016 Share Posted December 13, 2016 You could do this: Analytics::SendGenericEvent("Level Seed",seed) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 13, 2016 Author Share Posted December 13, 2016 Thanks, I will give it go tonight. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 17, 2016 Author Share Posted December 17, 2016 So although using analytics is certainly cool and provides a lot of insights, we can not use it for querying inside the game. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 17, 2016 Share Posted December 17, 2016 gameanalytics.com does support querying data, but it is not in the Leadwerks API yet. The most interesting application of this would be to construct a heatmap revealing player movements throughout your level. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.