PDA

View Full Version : NetRemote.GetVariable



KRO74
December 18th, 2009, 05:13 AM
Hi,

I'm having a problem to read a NR variable in LUA. If I look in the NR Variable Inspector I can see there is data in the variable but the LUA code returns nil, please see code below.
I could, somehow, check to see what type of data that was in the variable and that returned String.

Any comment would be appriciated



function UpdateWeather()
local wItem
local wIcon
local wCount
local wItemlist
local wTemp
local test1
wItem = 1
wCount = 1
print("Update ongoing...")
repeat
wItemlist = NetRemote.GetVariable("MEDIASERVER\RSS\Yahoo Weather\ItemList.Values_1_Description")
wCount = string.find (wItemlist, '.', 1)
wIcon = string.sub(wItemlist, 1, wCount)
NetRemote.SetVariable('w'..wItem, wIcon)
wItem = wItem + 1
print (wItemlist)
until wItem ==25
print ("Updated")
end

Rob H
December 18th, 2009, 06:33 AM
You either need to enclose the variable name in [[ ]] style quotes or double up the backslashes i.e.


wItemlist = NetRemote.GetVariable([[MEDIASERVER\RSS\Yahoo Weather\ItemList.Values_1_Description]])

or


wItemlist = NetRemote.GetVariable("MEDIASERVER\\RSS\\Yahoo Weather\\ItemList.Values_1_Description")

KRO74
December 18th, 2009, 07:21 AM
Thanks, works perfectly now. It's the small things.......