Jump to content




find out type of variable?


  • You cannot reply to this topic
5 replies to this topic

#1 YUGATUG

  • Members
  • 56 posts

Posted 06 April 2015 - 08:34 PM

Is there an api or function to get the type of variable a variable is?

#2 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 06 April 2015 - 08:40 PM

There's a function called 'type'. It returns the type of the variable as a string:

print( type( "" ) ) --> string

print( type( 1 ) ) --> number

You should really use google more often, it's way faster than asking here for these little things.

#3 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 06 April 2015 - 08:41 PM

The type function is what you are looking for.

Edit: Ninja'd

Edited by SquidDev, 06 April 2015 - 08:41 PM.


#4 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 06 April 2015 - 08:41 PM

I believe type(variable) will return the type of variable.

EDIT: :ph34r: 'd

Edited by Dog, 06 April 2015 - 08:42 PM.


#5 YUGATUG

  • Members
  • 56 posts

Posted 06 April 2015 - 09:15 PM

Uh... What is this ninja'd thing? Also thanks
MKlegoman357

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 April 2015 - 09:20 PM

http://www.google.com/search?q=ninja'd





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users