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.FindName - Search directory by host name

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

"uid" = lp.FindName("name");

Description

Search into the loriotpro directory and get the first object with the specified name and return its UID

Parameters

"name" - A character string with the name to search for (not case sensitive).

Return Values

UID - The UID of the object or nil

Example

We check that the UID with the name "Google" exist before running the script and check it.

Find Name LUA

Find Name LUA

Script code

uid=lp.FindName('google');
if uid then lp.Print('found uid ',uid,"\n") end

uid=lp.FindName('Google');

if uid then lp.Print('found uid ',uid,"\n") end

uid=lp.FindName('Goog');

if uid then lp.Print('found uid ',uid,"\n") end

Find Name LUA

 The two first requests works because the function is not case sensitive, thus the third one doesn't work.

Warning  ! If there is multiple object in the LoriotPro Directory with the same name, The retruned UID is alway the one of the first object found.

 


www.loriotpro.com