User Tools

Site Tools


embeddedapi:devel:lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
embeddedapi:devel:lua [2013/07/09 16:06]
linuxmaniac [sr.xavp.get]
embeddedapi:devel:lua [2014/01/03 16:16]
linuxmaniac [sr.xavp.get]
Line 312: Line 312:
 ==== sr.xavp.get_keys ==== ==== sr.xavp.get_keys ====
  
-returns array table with the key names of the xavp variable.+returns an array table with the key names of the xavp variable.
  
 Prototype Prototype
Line 331: Line 331:
 t = sr.xavp.get_keys("test", 0) t = sr.xavp.get_keys("test", 0)
 for k,v in pairs(t) do for k,v in pairs(t) do
-  print(string.format("%d:%s\n", k, v)+  sr.log("info", string.format("%d:%s\n", k, v))
 end end
 </code> </code>
Line 346: Line 346:
  
 returns a dictionary table with the values of the xavp variable. returns a dictionary table with the values of the xavp variable.
 +Third param is optional and it choose between get all the values of a key ( 0, default) or just the first ones (1)
 +
 +If second param is nil will return all indexes. If second param is <0 will return the index counting from then end ( -1 is the last value )
  
 Prototype Prototype
  
 <code c> <code c>
-t = sr.xavp.get("xavp_name"1)+ sr.xavp.get(xavp_name, indx, flag)
 </code> </code>
  
Line 356: Line 359:
  
 <code c> <code c>
 +$xavp(test=>a) = 4;
 +$xavp(test[0]=>b) = "four";
 +$xavp(test[0]=>a) = 5;
 +$xavp(test[0]=>b) = "five";
 +$xavp(test[0]=>a) = 6;
 +$xavp(test[0]=>b) = "six";
 +
 $xavp(test=>a) = 1; $xavp(test=>a) = 1;
 $xavp(test[0]=>a) = 2; $xavp(test[0]=>a) = 2;
Line 365: Line 375:
  
 <code c> <code c>
-t = sr.xavp.get("test", 0) + t = sr.xavp.get("test", 0, 0) 
-for k,t2 in pairs(t) do + sr.log("dbg"string.format("sr.xavp.get('test', 0, 0)->%s\n", table.tostring(t))) 
- for i,v in ipairs(t2do + t = sr.xavp.get("test", 0, 1
-   sr.log("info", string.format("%s[%d]:%s[%s]\n", kitostring(v), type(v))) + sr.log("dbg", string.format("sr.xavp.get('test', 0, 1)->%s\n", table.tostring(t))) 
- end + t = sr.xavp.get("test", nil, 0) 
-end+ sr.log("dbg", string.format("sr.xavp.get('test', nil, 0)->%s\n", table.tostring(t))) 
 + t = sr.xavp.get("test"nil1) 
 + sr.log("dbg", string.format("sr.xavp.get('test', nil, 1)->%s\n"table.tostring(t))) 
 + t = sr.xavp.get("test", -1, 1) 
 + sr.log("dbg", string.format("sr.xavp.get('test', -1, 1)->%s\n", table.tostring(t)))
 </code> </code>
  
Line 376: Line 390:
  
 <code c> <code c>
-a[1]:3[number] + sr.xavp.get('test', 0, 0)->{a={3,2,1},b={"three","two","one"}} 
-a[2]:2[number] + sr.xavp.get('test', 0, 1)->{a=3,b="three"} 
-a[3]:1[number] + sr.xavp.get('test', nil, 0)->{{a={3,2,1},b={"three","two","one"}},{a={6,5,4},b={"six","five","four"}}} 
-b[1]:three[string] + sr.xavp.get('test', nil, 1)->{{a=3,b="three"},{a=6,b="six"}} 
-b[2]:two[string] + sr.xavp.get('test', -1, 1)->{a=6,b="six"}
-b[3]:one[string]+
 </code> </code>
 ===== SR.SL Package ===== ===== SR.SL Package =====
embeddedapi/devel/lua.txt · Last modified: 2017/06/23 11:31 by sdamm