0
votes

A table received from a Gaming API (World of Warcraft) prints the following result as a whole

local sometbl = APICommand("args");
print(sometbl) --prints table: 000001F492F31.... 

basically some memory address I presume.

while trying either print(sometbl[1]) or print(sometbl[2]) the output is nil.

While trying

for key, value in next, sometbl do
    print(key .. " ".. value)
end

OR

for key, value in pairs(sometbl) do
    print(key .. " ".. value)
end

OR

for key, value in ipairs(sometbl) do
    print(key .. " ".. value)
end

No output is generated from any of these.

the print(sometbl) still prints said memory reference

How do can I print the entire contents of that peculiar table?

2

2 Answers

2
votes

If

for key, value in pairs(sometbl) do
    print(key .. " ".. value)
end

prints nothing the table is empty. So there is no content to print.

next(sometbl) will return nil if the table is empty.

1
votes

You can use the /dump command too for easier inspecting of (empty) tables, e.g. /dump APICommand("args")