wiki.sine.space | sinespace

Difference between revisions of "Scripting/SWebResponse"

From wiki.sine.space
Jump to: navigation, search
Line 4: Line 4:
 
{{ScriptFunction|string|Error|{ get; }|Any error, will be empty or null if the request was successful|5 = local response = function(data)<br>
 
{{ScriptFunction|string|Error|{ get; }|Any error, will be empty or null if the request was successful|5 = local response = function(data)<br>
 
&nbsp;&nbsp;if  data.Error == "" then<br>
 
&nbsp;&nbsp;if  data.Error == "" then<br>
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log("Error Found")<br>
 
&nbsp;&nbsp;else<br>
 
 
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log("Data Loaded")<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log("Data Loaded")<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(data.Response)<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(data.Response)<br>
 +
&nbsp;&nbsp;else<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log("Error Found")<br>
 
&nbsp;&nbsp;end<br>     
 
&nbsp;&nbsp;end<br>     
 
end}}
 
end}}
  
{{ScriptFunction|string|Response|{ get; }|The body text of the webpage response if error is empty or null}}
+
{{ScriptFunction|string|Response|{ get; }|The body text of the webpage response if error is empty or null|5 = local response = function(data)<br>
 +
&nbsp;&nbsp;if  data.Error == "" then<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(data.Response)<br>
 +
&nbsp;&nbsp;end<br>   
 +
end}}
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 05:31, 17 February 2017

The SWebResponse class returns the result of a HTTP GET/POST request

Fields

Error

string Error { get; }

Any error, will be empty or null if the request was successful

local response = function(data)

  if data.Error == "" then
    Space.Log("Data Loaded")
    Space.Log(data.Response)
  else
    Space.Log("Error Found")
  end

end


Response

string Response { get; }

The body text of the webpage response if error is empty or null

local response = function(data)

  if data.Error == "" then
    Space.Log(data.Response)
  end

end