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:
cats = {}
cats.names = {}

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

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

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

for k,v in pairs (cats[name]) do
fed_cats[k] = v;
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”.

A = “Hello”
B = {}

print( type( A ), type( B ) )

string       table

Thanks, forgot about that.