Is it var or table?

How can I know if it’s a simple var or a table?

Why? Well, I want to make something like this:
[lua]
cats = {}
cats.names = {}

cats[“john”].names = {“Pussy”,“Tom”,“Terry”}

cats[“gaylord”].names = “Jerry”
[/lua]

Then, I’ll want to do something like
[lua]
local name = “gaylord”
local fed_cats = {}

for k,v in pairs (cats[name]) do
fed_cats[k] = v;
end
[/lua]
Wouldn’t what return an error or something? I think, I should somehow check, if cats[“gaylord”].names is a table or a string?

type( Variable ) will return the type of the variable as a string.

In your case either “table” or “string”.

[lua]
A = “Hello”
B = {}

print( type( A ), type( B ) )
[/lua]



string       table


Thanks, forgot about that.
/thread