PDA

View Full Version : netremote lua help



yonu
December 8th, 2010, 04:32 PM
hey I am hoping someone can help me out I am working on a small piece of lua for a interface but I can't get part of it to work the way I want one issue I have is with the %d%d%d I used if the volume is less thatn 100 it errors is there away to not have this happen

here is the code

function upsvolup()
PostAddress = "http://192.168.1.6:8800/xbmcCmds/xbmcHttp?command=setvolume&parameter="
body = socket.http.request("http://192.168.1.6:8800/xbmcCmds/xbmcHttp?command=getvolume")
print(body)
currentVolume = string.sub(body, string.find(body, '%d%d%d'))
print(currentVolume)
if currentVolume <= 100 then
NetRemote.SetVariable("upsvol", currentVolume)
print("if")
end
end

here is the error

<html>
<li>100</html>
100
Lua (Unknown)
upsvolup();
Error running lua chunk
[string "C:\Users\Reg\Desktop\CFFt\nowplaying\Nowpla..."]:28: attempt to compare string with number


Thanks,
Reg

yonu
December 8th, 2010, 08:12 PM
I found a work around so to speak i added in a slider to replace the volume buttons however I have been unable to get the slider to trigger a lua event on release is there a trick to this?

Thanks

yonu
December 8th, 2010, 08:44 PM
ok I hope someone can help me out on this I cant get the slider to update the text on the netremote screen when it moves but I am unable to get it to update the variable for the lua script any help would be great

Thanks,
Reg