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

lpav.GetAllGlobalValue

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 = lpav.GetAllGlobalValue('array')

Description

This LUA function retrieve in a LUA table the value of global variables attached to a specific Active View.

Parameters

array - a LUA array of variable

Return Values

value : 1 if succeeded

Return nil if an error occurs

Example

 

lpav.SetGlobalValue("value01","hello word 01");
lp.Print("value01 set to : ",lpav.GetGlobalValue("value01"),"\n");
lpav.SetGlobalValue("value01","hello word 02");
lp.Print("value01 set to : ",lpav.GetGlobalValue("value01"),"\n");
lpav.SetGlobalValue("value01","hello word 03");
lp.Print("value01 set to : ",lpav.GetGlobalValue("value01"),"\n");
lpav.SetGlobalValue("value01","hello word 04");
lp.Print("value01 set to : ",lpav.GetGlobalValue("value01"),"\n");
lpav.SetGlobalValue("value01","hello word 05");
lp.Print("value01 set to : ",lpav.GetGlobalValue("value01"),"\n");

lpav.SetGlobalValue("value02","hello word value02\\ttt");
lpav.SetGlobalValue("value03","hello word value03\\ttt");
lpav.SetGlobalValue("value04",'hello word "value04"\\tt\\n');
lp.Print("List all values\n");
if lpav.GetAllGlobalValue("data") then
for key,value in pairs(data) do
lp.Print('<',key,'>',value,'</',key,'>\n')
end
end
lp.Print("Delete value02\n");
lpav.DeleteGlobalValue("value02");
lp.Print("Display value02 (Bad value) : ",lpav.GetGlobalValue("value02"),"\n");
lp.Print("List all values\n");

if lpav.GetAllGlobalValue("data") then

for key,value in pairs(data) do
lp.Print('<',key,'>',value,'</',key,'>\n')
end
end
lp.Print("Delete all value\n");
lpav.DeleteAllGlobalValue();
lp.Print("List all values\n");

if lpav.GetAllGlobalValue("data") then
for key,value in pairs(data) do
lp.Print('<',key,'>',value,'</',key,'>\n')
end
end

example of return

value01 set to : hello word 01
value01 set to : hello word 02
value01 set to : hello word 03
value01 set to : hello word 04
value01 set to : hello word 05
List all values
<value01>hello word 05</value01>
<value03>hello word value03\ttt</value03>
<value02>hello word value02\ttt</value02>
<value04>hello word "value04"\tt\n</value04>
Delete value02
Display value02 (Bad value) : bad value
List all values
<value01>hello word 05</value01>
<value03>hello word value03\ttt</value03>
<value04>hello word "value04"\tt\n</value04>
Delete all value
List all values

 


www.loriotpro.com