PDA

View Full Version : NetRemote.SetTimer usage changed?



vitello
August 5th, 2007, 12:23 AM
I was checking out the HVAC simulation in the new-pro_480x640.ccf and noticed that the sliders weren't automatically moving. The help menu mentions that value slider should slowly move to the set slider position. I took a look at the new-pro.lua and found the problem. In the HVAC.Timer function the value of zoneobj is nil so the zoneobj.value variable can't be updated. zoneobj is nil because HVAC.Timers[timerid] is nil. The only member in the HVAC.Timers table is HVAC.Timers[zoneobj.timer], which is set in the HVAC.Set funtion. zoneobj.timer is the timer returned by NetRemote.SetTimer, but it is not equal to timerid even though this is what the documentation says it should be. So it looks like something changed with NetRemote.SetTimer usage or something is wrong with the lua file that I don't see. Is the HVAC Simulation on the Temperature page working for anyone else?

Peter

Rob H
August 5th, 2007, 03:14 AM
Okay, I can confirm the problem. It looks as though the userdata returned by SetTimer can't be used as a key in a table for some reason.

I've attached a new version of new-pro.lua that works around this issue by using a closure.

vitello
August 5th, 2007, 09:44 AM
Rob H

Thanks for the quick response. I like the new version as it is nice and clear as to what gets passed.

Peter