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.shifttoleft - Perform a binary left 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.


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


The lp.shifttoleft LUA function performs a binary left shift of a LUA number


value1      An Integer LUA number 

shift        The number of binary left shift.

Return Values

value         The result value     

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

nil               If an error occurs.


We perform 16 shifts on the left

for i=1,16 do

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

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


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

shift  to left in LUA