Jump to content

Lua webservice/http requests


AggrorJorn
 Share

Recommended Posts

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.

  • Upvote 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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()

Link to comment
Share on other sites

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.

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...