0

I am using the following lua script to access and read an external lua file:

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

However, when the values for the exec key are returned, I am getting a hexadecimal memory location. FOr example, one line of output is as follows:

table: 07x7fdc5b2538f0
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
amber4478
  • 6,433
  • 3
  • 20
  • 17

1 Answers1

1

As I replied on your previous question; you need recursive call to a function. A sample program exists 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
Community
  • 1
  • 1
hjpotter92
  • 78,589
  • 36
  • 144
  • 183