LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lp.shifttoright - Perform a binary right shift

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

value,’uint64’ = lp.shifttoright(value1,shift );

Description

The lp.shifttoright LUA function performs a binary right shift of a LUA number

Parameters

value1      An Integer LUA number 

shift        The number of binary right shift.

Return Values

value         The result value     

‘uint64’      A character string of the result showing an unsigned 64 bits.

nil               If an error occurs.

Example

We perform 16 shifts on the right

for i=1,16 do

value,buffer = lp.shifttoright(0xFFFFFFFF,i);

lp.Print("result : 0x", lp.ascii_ui64ToHex(buffer),"\n");

end

Warning  ! The bits on the left are limiuted to the size of 64 bits unsigned number, upper bits will be lost.

right shift in LUA

 

 


www.loriotpro.com