User Tools

Site Tools


curves

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
curves [2020/08/03 13:33] atolstovcurves [2021/09/10 14:33] atolstov
Line 1: Line 1:
 +{{ :menu-icon-curves.png?nolink&60|}}
 ======Curves====== ======Curves======
 =====Introduction===== =====Introduction=====
Line 88: Line 89:
 {{ :curve:reg_filled_with_equat.png?direct&600 |}} {{ :curve:reg_filled_with_equat.png?direct&600 |}}
  
-=====Get value from the curve=====+=====Get value from the curve via Lua =====
  
 To get the **OUTPUT y value** from existing(pre-created) curve, you need: To get the **OUTPUT y value** from existing(pre-created) curve, you need:
Line 134: Line 135:
 <code lua - Getter> <code lua - Getter>
 include "curves.lib" include "curves.lib"
 +SAFE_VALUE = 10
  
 function main (userId) function main (userId)
Line 140: Line 142:
     current_hour = tonumber(t.hour)     current_hour = tonumber(t.hour)
     curve_status, y = GetCurveValue( "curve_for_current_hour", current_hour )     curve_status, y = GetCurveValue( "curve_for_current_hour", current_hour )
-    WriteReg("value_for_current_hour", y) +    if curve_status then 
 +        WriteReg("value_for_current_hour", y) 
 +    else 
 +        WriteReg("value_for_current_hour", SAFE_VALUE) 
 +    end 
 +        
  
 end end
curves.txt · Last modified: 2024/06/03 08:45 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki