Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


http luaSocket help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Thu Oct 24, 2013 11:44 am    Post subject: http luaSocket help Reply with quote

hello can anyone help me !! I have made a trainer which calls the script from my site !! its like
Code:

http = require("socket.http")
file = http.request("http:/mysite.com")
loadstring(file)()


now is there any way to directly call script from another site where i have stored them ?? like sometimes i get a nill value while calling script as my website goes down sometimes making the socket request to timeout and give me lua error .Is there is any way to do something like this ??

for example

http = require("socket.http")
file = http.request("http://mysite.com")
loadstring(file)()

if file= nil then

http = require("socket.http")
file = http.request("http://mysite2.com")
loadstring(file)()


?? i need help on this Asap please !

Thanks Smile
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Oct 24, 2013 3:15 pm    Post subject: Reply with quote

Code:
file = http.request("http://mysite.com")
if (file) then
      loadstring(file)()
   else
      file = http.request("http://mysite2.com")
   if (file) then
      loadstring(file)()
   else
      return closeCE()
   end
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Oct 25, 2013 10:46 am    Post subject: Reply with quote

Better example for those who need.
Code:
function getFile(param)
   local location = param or 'http://site1.com/';
   if (not http) then
      http = require("socket.http");
   end
   local file,response = http.request(location);
   if (response == 200 and file ~= nil and file ~= '' and not(string.find(file,'html'))) then
      return file;
   else
      if not(param) then
         return getFile('http://site2.com/');
      else
         return closeCE();
      end
   end
end

local a = getFile();
print(a); -- Data which was receieved from one of the two sites.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites