local int_to_bool = function( int iH )
if iH == 1 then
return true
elseif iH == 0 then
return false
else
return false
print( string.format( 'unexpected error: int = %s', iH ) )
end
end
local switch = function()
if not ui.my_check_box:get() then return end
if not engine.is_connected() then return end
refs.inverter:set( int_to_bool( math.random( 0, 1 ) ) )
end
client.register_callback( 'paint', switch )