Jump to content
  • 0

Function output to variable


Question

Hi

I have this function

function getHueLight(id)
  	
  	local hueIP = 'xxx.xxx.xxx.xxx'
  	local huePort = '80'
  	local hueKey = '--------------------------------'
	local requestUrl = "http://"..hueIP..":"..huePort.."/api/"..hueKey.."/lights/"..id;
	local httpClient = net.HTTPClient();
	httpClient:request(requestUrl, { 
    	options = {
      		headers={},
      		method='GET'
    	},
   		success =  function (response) fibaro: debug (response. data)  end,
   		error  =  function (err) fibaro: debug ("Error:"  .. err)  end
  	});
  
end

and i want to assign output of this to variable

i've tried somthing like this

local var = getHueLight(id)

but it's get nil value

 

 

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
1 hour ago, marczu said:

Hi

I have this function

and i want to assign output of this to variable

i've tried somthing like this

local var = getHueLight(id)

but it's get nil value

 

Your success function gets called after the main scene terminates.

 

 

Edited by jgab
  • Thanks 1
Link to post
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.

Guest
Answer this question...

×   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.

×
×
  • Create New...