LoriotPro
scripting documentation 
The second way of using LUA script language in the expression of Active View graphical object is called inline. The expression of a graphical object can be a LUA script including SNMP Get command mixed with mathematical functions.
The syntax of the expression is:
Getipoid defip LUA_expression
example : getipoid defip ([hrstorageused.3]/[hrstoragesize.3]*100)
The LUA expression can contain multiple snmp requests. Each snmp request should be in brackets [] in the LUA expression. , other mathematical operator in parenthesis. To know what operators are available open the LUA 5.0 reference manual.
The object [$lastvalue] replace the string of by the last value obtained from this expression. This option is useful when working with counter snmp objects.
Example of expression:
Not recommended (The LUA expression parser support only 50 blocks)
( ( [hrstorageused.3] / [hrstoragesize.3] * 100 ) / 1000)
This expression return a value
#ERROR if the syntax is wrong or if the snmp object are not
found
1.#INF00 If there is divided by zero operation in the script
We are working on a VuMeter object, this one has a Unit field in its properties. If the option "Fill name" is checked the unit will be automatically added at this end of the object name in the view.
The fill name option replace the object name visible in the
view.
The unit option is added to the name
In the Active View below you can see the disk size directly displayed in the object name.
In the next example we use a virtual snmp objet to perform a calculation
This example use a sinus funtion.
Mathematical functions are listed in this LUA documentation extract:
This library is an interface to most of the functions of the standard C math library. (Some have slightly different names.) It provides all its functions inside the table math. In addition, it registers the global __pow for the binary exponentiation operator ^, so that x^y returns xy. The library provides the following functions:
math.abs 
Absolute value 
math.acos  Arc Cosinus 
math.asin  Arc Sinus 
math.atan  Arc Tangente 
math.atan2  
math.ceil  
math.cos  Cosinus 
math.deg  convert to degrees 
math.exp  Exponential 
math.floor  
math.log  Logarithm 
math.log10  Logarithm 10 
math.max  The function math.max returns the maximum value of its numeric argument 
math.min  math.min computes the minimum. Both can be used
with 1, 2, or more arguments. 
math.mod  Modulo 
math.pow  
math.rad  convert to radian 
math.sin  SiInus 
math.sqrt  Square root 
math.tan  Tangente 
math.frexp  
math.ldexp  
math.random  Generate a random number :The functions math.random and math.randomseed are interfaces to the simple random generator functions rand and srand that are provided by ANSI C. (No guarantees can be given for their statistical properties.) When called without arguments, math.random returns a pseudorandom real number in the range [0,1). When called with a number n, math.random returns a pseudorandom integer in the range [1,n]. When called with two arguments, l and u, math.random returns a pseudorandom integer in the range [l,u]. The math.randomseed function sets a "seed" for the pseudorandom generator: Equal seeds produce equal sequences of numbers. 
math.randomseed  
math.pi  and the PI variable 
Most of them are only interfaces to the corresponding
functions in the C library. All trigonometric functions work in radians (previous
versions of Lua used degrees). The functions math.deg and math.rad convert between
radians and degrees.
s.
www.loriotpro.com 
