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.ui64rest - Remainder of a division between two unsigned 64 bits

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, ‘buffer’ = lp.ui64rest(value1 , value2);


The lp.ui64rest LUA function provides the remainder of a division between two unsigned 64 bits values coded and defined as double.

With huge number in Standard LUA , the usage of double generate calculation error on unsigned 64 bits number. As unsigned 64 bits numbers are more currently used in SNMP V2 it is mandatory to use these 64 bits functions available in the LoriotPro environment for the manipulation of 64 bits counter for example.


value1 - An usigned 64 bits number defined in a double

value2 - An usigned 64 bits number defined in a double

Return Values

value : The result of the operation as an integer

buffer : The result of the operation as a character string representing an unsigned 64 bits value.  

Warning a division by 0 return the value ‘#DIV0'

Return nil if an error occurs


We do perform multiple divisions to show the relevance of this function.

The LUA code :


lp.Print("Value : ",value," buffer : ",buffer,"\n");


lp.Print("Value : ",value," buffer : ",buffer,"\n");


lp.Print("Value : ",value," buffer : ",buffer,"\n");


lp.Print("Value : ",value," buffer : ",buffer,"\n");


lp.Print("Value : ",value," buffer : ",buffer,"\n");

The results

remainder of division of 64 bits number in lua