Checking variable type

Hello Devs,

I am wonder how will I, in script, find if the Variable is a table, number, string, ect. The only solution I have is only for bool values

local variable = true -- boolen value

if variable == true or false then
  print("this is a bool value")

  else
  print("this could be a string, table, or a int.")   
end

how will the script figure if the variable is a table, string, or int? and is there a better way to figure it out?

we have type() and typeof() for these types of things

Hey,

Thanks for the really fast response! it helped!

Heads up for the future, if you make code similar this, do it like this instead.

if variable == true or variable == false then

Otherwise the statement will only run if the variable is equal to true.

Oh thank you I didn’t think of that at the time of writing it. Thanks for the heads up!