Help With Tables

I know how to print specific entries from a table, but how to you print a specific field from a table?




thetable = {}

PrintTable ( thetable[3] )



This would print the third entry in the table, how would print a specific field within an entry?

[lua]
print( thetable[3] )
[/lua]

Did not work, and wouldn’t that only print entry[3] like I already know how to do?

Here is what my table is printing, id like to only grab the positions.



1:
		class	=	death
		pos	=	-79.018898 292.711700 -12267.968750
2:
		class	=	fire
		pos	=	-26.074100 577.555115 -12267.968750



[lua]
for k,v in ipairs(thetable) do
local pos = v.pos
print(pos)
end
[/lua]

Works great brandon! Whats the deal with ipairs? I have never seen that before.

It’s used for tables that have integers for their indexes that are sequentially incremented, which can be called a hash table.

You can learn more about it here:
http://lua-users.org/wiki/GeneralizedPairsAndIpairs

Thanks for the documentation I appreciate it.