PDA

View Full Version : Incorporating variable in network.get script



tonyG
July 20th, 2016, 05:42 AM
Hi Folks,

Trying to update a property set by a variable [fader] to another app using network.get in Girder (extract of LUA script in girder):
network.get( "http://127.0.0.1:8001/SPV?D=Alpine&P=Fader&V=[fader]&S=HB4ME", function ( success, status, body )

[fader] is a variable value derived from using "Get Caption". As a variable, [fader] works in Girder 6 OSD, and it displays the new fader value e.g. F2, R4 etc.

The target app (Housebot) receives the message, and displays "[fader]" - not the actual value.

I've spent quite some time looking for a solution without luck. How can I incorporate a variable value in network.get?

Any help very much appreciated!

Ron
July 20th, 2016, 06:55 AM
Probably:



local url = "http://127.0.0.1:8001/SPV?D=Alpine&P=Fader&V=" .. fader .. "&S=HB4ME"
print(url)
network.get(url, function ( success, status, body )


fader is most likely just a lua variable. Hence you concat the strings before use. Check that the output in the lua console is what you expect.

tonyG
July 20th, 2016, 07:29 AM
Perfect!

Thanks Ron, worked first time.