lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Im trying to look at my table values, using debug.getlocal, but i dont have any clue how to do it. With debug.getlocal i have only obtained an adress of the table e.g. : tabl=table: 0x8d8fff0.
Here is a code which i have made 
function C(a,b)
  local t ={}
  t["idx_1"] = "val_1"
  t["idx_2"] = "val_2"
  for K, V in pairs(debug.getinfo(1)) do 
    print(K, V) 
  print("stack frame 1")
  for i=1,10 do
    k, v = debug.getlocal(1,i)
    print( tostring(i) .. " " .. tostring(k) .. "=" .. tostring(v))
  return c
and the output:
source example1.lua                                                                                                           
what  Lua                                                                                                                     
func function: 0x8d90c20                                                                                                     
nups  0                                                                                                                       
short_src    example1.lua                                                                                                    
name  C                                                                                                                       
currentline  8                                                                                                               
namewhat  global                                                                                                          
linedefined   2                                                                                                               
stack frame 1                                                                                                                   
1 a=1                                                                                                                           
2 b=2                                                                                                                           
3 t=table: 0x8d8fff0                                                                                                            
4 (for index)=4                                                                                                                 
5 (for limit)=10                                                                                                                
6 (for step)=1                                                                                                                  
7 i=7                                                                                                                           
8 nil=nil                                                                                                                       
9 nil=nil                                                                                                                       
10 nil=nil  

Thank You in advance for any help