Local function setVariable() must be defined before use.

Henrik, this change will resolve the exception reported by lininger in http://forum.micasaverde.com/index.php/topic,24796.msg173035.html#msg173035.  In lua, we need to define local functions before invoking them.