2013-04-15 8 views
0

내가 외부 루아 파일에 액세스하고 읽을 수있는 다음과 같은 루아 스크립트를 사용하고 다음 간부 키의 값이 반환 될 때루아 읽기와 쓰기 테이블 데이터

FileStr = "lariatData-sgeT-2012-05-31.lua" 
Hnd, ErrStr = io.open(FileStr, "r") 
if Hnd then 
    dofile(FileStr) 
    for Str in Hnd:lines() do 
     print(Str, "\n") 
     for exec, val in pairs(sgeT) do 
      print(exec.." "..val, "\n") 
     end 
    end 
    Hnd.close() 
else 
    print(ErrStr, "\n") 
end 
그러나

, 나는 16 진수 메모리를 얻고을 위치. 예를 들어, 다음과 같이 하나의 행으로 된 출력은 다음과 같습니다

table: 07x7fdc5b2538f0 

답변

1

내가 이전의 질문에 대답 같이, 함수에 대한 재귀 호출이 필요합니다. 샘플 프로그램은 here입니다.

function DeepPrint (e) 
    -- if e is a table, we should iterate over its elements 
    if type(e) == "table" then 
     for k,v in pairs(e) do -- for every element in the table 
      print(k) 
      DeepPrint(v)  -- recursively repeat the same procedure 
     end 
    else -- if not, we can just print it 
     print(e) 
    end 
end